Edit

Share via


KeyedServiceCollectionExtensions.GetServiceByName<TService> Method

Definition

Acquire a service by name.

public static TService GetServiceByName<TService> (this IServiceProvider services, string name) where TService : class;
static member GetServiceByName : IServiceProvider * string -> 'Service (requires 'Service : null)
<Extension()>
Public Function GetServiceByName(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