Click or drag to resize

ServiceHelperGetServiceT Method (IServiceProvider)

Gets a service from a given service provider, throwing a ServiceNotAvailableException if the service is not available.

Namespace:  AGI.Foundation.Infrastructure
Assembly:  AGI.Foundation.Core (in AGI.Foundation.Core.dll) Version: 22.2.414.0 (22.2.414.0)
Syntax
public static T GetService<T>(
	IServiceProvider serviceProvider
)
where T : class

Parameters

serviceProvider
Type: SystemIServiceProvider
The service provider from which to obtain the service.

Type Parameters

T
The type of service to obtain.

Return Value

Type: T
The requested service.
Exceptions
ExceptionCondition
ArgumentNullException Thrown when the serviceProvider is .
ServiceNotAvailableException Thrown when the requested service is not available from the service provider.
See Also