'Declaration
<ExtensionAttribute()> <CanBeNullAttribute()> Public Shared Function TryGetRequiredService(Of TService)( _ ByVal serviceProvider As IServiceProvider, _ ByRef service As TService _ ) As Exception
'Usage
Dim serviceProvider As IServiceProvider Dim service As TService Dim value As Exception value = IServiceProviderExtension.TryGetRequiredService(Of TService)(serviceProvider, service)
[Extension()] [CanBeNull()] public static Exception TryGetRequiredService<TService>( IServiceProvider serviceProvider, out TService service )
[Extension()] [CanBeNull()] public: static Exception^ TryGetRequiredServicegeneric<typename TService> ( IServiceProvider^ serviceProvider, [Out] TService^ service )
Parameters
- serviceProvider
- The service provider.
- service
- A service object of type TService.
Type Parameters
- TService
- The type of service object to get.
Return Value
Returns
null
when the service object has been successfully retrieved. If there is no service of the requested type, returns a non-null
exception.