共用方式為


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

適用於