KeyedServiceExtensions.GetServiceByKey<TKey,TService> 方法

定义

按密钥获取服务。

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

类型参数

TKey
TService

参数

services
IServiceProvider
key
TKey

返回

TService

适用于