Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

interface Microsoft.​Extensions.​DependencyInjection.​IKeyedServiceProvider

Assembly: Microsoft.Extensions.DependencyInjection.Abstractions

Implemented Interfaces

Retrieves services using a key and a type.

Methods

object
GetKeyedService​(System.​Type serviceType, object serviceKey)
Gets the service object of the specified type.
Returns <para>A service object of type <paramref name="serviceType" />.</para> <para>-or-</para> <para> <see langword="null" /> if there is no service object of type <paramref name="serviceType" />.</para>
serviceType An object that specifies the type of service object to get.
serviceKey An object that specifies the key of service object to get.
object
GetRequiredKeyedService​(System.​Type serviceType, object serviceKey)
Gets service of type <paramref name="serviceType" /> from the <see cref="T:System.IServiceProvider" /> implementing this interface.
Returns A service object of type <paramref name="serviceType" /> . Throws an exception if the <see cref="T:System.IServiceProvider" /> cannot create the object.
serviceType An object that specifies the type of service object to get.
serviceKey The <see cref="P:Microsoft.Extensions.DependencyInjection.ServiceDescriptor.ServiceKey" /> of the service.