Language

ServiceProviderKeyedServiceExtensions.GetKeyedService メソッド

定義

オーバーロード

名前 説明
GetKeyedService(IServiceProvider, Type, Object)

serviceTypeからIServiceProvider型のサービスを取得します。

GetKeyedService<T>(IServiceProvider, Object)

TからIServiceProvider型のサービスを取得します。

GetKeyedService(IServiceProvider, Type, Object)

ソース:
ServiceProviderKeyedServiceExtensions.cs
ソース:
ServiceProviderKeyedServiceExtensions.cs
ソース:
ServiceProviderKeyedServiceExtensions.cs

serviceTypeからIServiceProvider型のサービスを取得します。

public:
[System::Runtime::CompilerServices::Extension]
 static System::Object ^ GetKeyedService(IServiceProvider ^ provider, Type ^ serviceType, System::Object ^ serviceKey);
public static object? GetKeyedService(this IServiceProvider provider, Type serviceType, object? serviceKey);
static member GetKeyedService : IServiceProvider * Type * obj -> obj
<Extension()>
Public Function GetKeyedService (provider As IServiceProvider, serviceType As Type, serviceKey As Object) As Object

パラメーター

provider
IServiceProvider

サービス オブジェクトを取得する IServiceProvider 。

serviceType
Type

取得するサービス オブジェクトの種類を指定するオブジェクト。

serviceKey
Object

取得するサービス オブジェクトのキーを指定するオブジェクト。

返品

serviceType型のサービス オブジェクト。そのようなサービスがない場合は null です。

適用対象

GetKeyedService<T>(IServiceProvider, Object)

ソース:
ServiceProviderKeyedServiceExtensions.cs
ソース:
ServiceProviderKeyedServiceExtensions.cs
ソース:
ServiceProviderKeyedServiceExtensions.cs
ソース:
ServiceProviderKeyedServiceExtensions.cs
ソース:
ServiceProviderKeyedServiceExtensions.cs

TからIServiceProvider型のサービスを取得します。

public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
 static T GetKeyedService(IServiceProvider ^ provider, System::Object ^ serviceKey);
public static T? GetKeyedService<T>(this IServiceProvider provider, object? serviceKey);
static member GetKeyedService : IServiceProvider * obj -> 'T
<Extension()>
Public Function GetKeyedService(Of T) (provider As IServiceProvider, serviceKey As Object) As T

型パラメーター

T

取得するサービス オブジェクトの型。

パラメーター

provider
IServiceProvider

サービス オブジェクトを取得する IServiceProvider 。

serviceKey
Object

取得するサービス オブジェクトのキーを指定するオブジェクト。

返品

T

T型のサービス オブジェクト。そのようなサービスがない場合は null です。

適用対象