ServiceProviderServiceExtensions.GetRequiredService ServiceProviderServiceExtensions.GetRequiredService ServiceProviderServiceExtensions.GetRequiredService Method

Definition

Overloads

GetRequiredService(IServiceProvider, Type) GetRequiredService(IServiceProvider, Type) GetRequiredService(IServiceProvider, Type)

Get service of type serviceType from the IServiceProvider.

GetRequiredService<T>(IServiceProvider) GetRequiredService<T>(IServiceProvider) GetRequiredService<T>(IServiceProvider)

Get service of type T from the IServiceProvider.

GetRequiredService(IServiceProvider, Type) GetRequiredService(IServiceProvider, Type) GetRequiredService(IServiceProvider, Type)

Get service of type serviceType from the IServiceProvider.

public static object GetRequiredService (this IServiceProvider provider, Type serviceType);
static member GetRequiredService : IServiceProvider * Type -> obj
<Extension()>
Public Function GetRequiredService (provider As IServiceProvider, serviceType As Type) As Object

Parameters

provider
IServiceProvider IServiceProvider IServiceProvider

The IServiceProvider to retrieve the service object from.

serviceType
Type Type Type

An object that specifies the type of service object to get.

Returns

A service object of type serviceType.

Exceptions

GetRequiredService<T>(IServiceProvider) GetRequiredService<T>(IServiceProvider) GetRequiredService<T>(IServiceProvider)

Get service of type T from the IServiceProvider.

public static T GetRequiredService<T> (this IServiceProvider provider);
static member GetRequiredService : IServiceProvider -> 'T
<Extension()>
Public Function GetRequiredService(Of T) (provider As IServiceProvider) As T

Type Parameters

T

The type of service object to get.

Parameters

provider
IServiceProvider IServiceProvider IServiceProvider

The IServiceProvider to retrieve the service object from.

Returns

T T T

A service object of type T.

Exceptions

Applies to