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.
class Microsoft.​Extensions.​DependencyInjection.​ServiceProviderKeyedServiceExtensions
Assembly: Microsoft.Extensions.DependencyInjection.Abstractions
Inheritance: object → ServiceProviderKeyedServiceExtensions
Extension methods for getting services from an <see cref="T:System.IServiceProvider" /> .
Methods
public static
System.​Collections.​Generic.​IEnumerable<​object>
GetKeyedServices​(System.​IServiceProvider provider,
System.​Type serviceType,
object serviceKey)
Get an enumeration of services of type <paramref name="serviceType" /> from the <see cref="T:System.IServiceProvider" /> .
Returns An enumeration of services of type <paramref name="serviceType" /> .
provider
The <see cref="T:System.IServiceProvider" /> to retrieve the services from.
serviceType
An object that specifies the type of service object to get.
serviceKey
An object that specifies the key of service object to get.
public static
System.​Collections.​Generic.​IEnumerable<​T>
GetKeyedServices​(System.​IServiceProvider provider,
object serviceKey)
Get an enumeration of services of type <typeparamref name="T" /> from the <see cref="T:System.IServiceProvider" /> .
Returns An enumeration of services of type <typeparamref name="T" /> .
provider
The <see cref="T:System.IServiceProvider" /> to retrieve the services from.
serviceKey
An object that specifies the key of service object to get.
public static
T
GetKeyedService​(System.​IServiceProvider provider,
object serviceKey)
Get service of type <typeparamref name="T" /> from the <see cref="T:System.IServiceProvider" /> .
Returns A service object of type <typeparamref name="T" /> or null if there is no such service.
provider
The <see cref="T:System.IServiceProvider" /> to retrieve the service object from.
serviceKey
An object that specifies the key of service object to get.
public static
object
GetKeyedService​(System.​IServiceProvider provider,
System.​Type serviceType,
object serviceKey)
Get service of type <paramref name="serviceType" /> from the <see cref="T:System.IServiceProvider" /> .
Returns A service object of type <paramref name="serviceType" /> or null if there is no such service.
provider
The <see cref="T:System.IServiceProvider" /> to retrieve the service object from.
serviceType
An object that specifies the type of service object to get.
serviceKey
An object that specifies the key of service object to get.
public static
object
GetRequiredKeyedService​(System.​IServiceProvider provider,
System.​Type serviceType,
object serviceKey)
Get service of type <paramref name="serviceType" /> from the <see cref="T:System.IServiceProvider" /> .
Returns A service object of type <paramref name="serviceType" /> .
provider
The <see cref="T:System.IServiceProvider" /> to retrieve the service object from.
serviceType
An object that specifies the type of service object to get.
serviceKey
An object that specifies the key of service object to get.
public static
T
GetRequiredKeyedService​(System.​IServiceProvider provider,
object serviceKey)
Get service of type <typeparamref name="T" /> from the <see cref="T:System.IServiceProvider" /> .
Returns A service object of type <typeparamref name="T" /> .
provider
The <see cref="T:System.IServiceProvider" /> to retrieve the service object from.
serviceKey
An object that specifies the key of service object to get.
public
bool
Equals​(object obj)
Inherited from object
protected
void
Finalize​()
Inherited from object
public
int
GetHashCode​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object
public
string
ToString​()
Inherited from object