Partager via


KeyedServiceCollectionExtensions.GetServiceByKey<TKey,TService> Méthode

Définition

Acquérir un service par clé.

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

Paramètres de type

TKey

Type de clé de service.

TService

Type de service.

Paramètres

services
IServiceProvider

Fournisseur de services.

key
TKey

Clé de service.

Retours

TService

Service.

S’applique à