KeyedServiceCollectionExtensions.GetServiceByKey<TKey,TService> Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Acquire a service by key.
public static TService GetServiceByKey<TKey,TService> (this IServiceProvider services, TKey key) where TService : class;
static member GetServiceByKey : IServiceProvider * 'Key -> 'Service (requires 'Service : null)
<Extension()>
Public Function GetServiceByKey(Of TKey, TService) (services As IServiceProvider, key As TKey) As TService
Type Parameters
- TKey
The service key type.
- TService
The service type.
Parameters
- services
- IServiceProvider
The service provider.
- key
- TKey
The service key.
Returns
TService
The service.