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: 24.2.419.0 (24.2.419.0)
Syntax public static T GetOptionalService<T>(
IServiceProvider serviceProvider
)
where T : class
Public Shared Function GetOptionalService(Of T As Class) (
serviceProvider As IServiceProvider
) As T
public:
generic<typename T>
where T : ref class
static T GetOptionalService(
IServiceProvider^ serviceProvider
)
static member GetOptionalService :
serviceProvider : IServiceProvider -> 'T when 'T : not struct
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:
TThe requested service, or
if the service does not exist.
Exceptions See Also