Düzenle

Aracılığıyla paylaş


KeyedServiceCollectionExtensions.GetRequiredServiceByName<TService> Method

Definition

Acquire a service by name, throwing if it is not found.

public static TService GetRequiredServiceByName<TService> (this IServiceProvider services, string name) where TService : class;
static member GetRequiredServiceByName : IServiceProvider * string -> 'Service (requires 'Service : null)
<Extension()>
Public Function GetRequiredServiceByName(Of TService As Class) (services As IServiceProvider, name As String) As TService

Type Parameters

TService

The service type.

Parameters

services
IServiceProvider

The service provider.

name
String

The service name.

Returns

TService

The service.

Applies to