Bewerken

Delen via


IKeyedServiceCollection<TKey,TService>.GetService Method

Definition

Overloads

GetService(TKey)
GetService(IServiceProvider, TKey)

Gets the service with the specified key.

GetService(TKey)

public TService GetService (TKey key);
abstract member GetService : 'Key -> 'Service
Public Function GetService (key As TKey) As TService

Parameters

key
TKey

Returns

TService

Applies to

GetService(IServiceProvider, TKey)

Source:
IKeyedServiceCollection.cs

Gets the service with the specified key.

public TService GetService (IServiceProvider services, TKey key);
abstract member GetService : IServiceProvider * 'Key -> 'Service
Public Function GetService (services As IServiceProvider, key As TKey) As TService

Parameters

services
IServiceProvider

The service provider.

key
TKey

The key.

Returns

TService

The service with the specified key.

Applies to