Click or drag to resize

ServiceHelperGetOptionalServiceT Method

Gets a service from a given service provider, or if the service does not exist.

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 GetOptionalService<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, or if the service does not exist.
Exceptions
ExceptionCondition
ArgumentNullException Thrown when the serviceProvider is .
See Also