Ioc.GetRequiredService<T> Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Resolves an instance of a specified service type.
public T GetRequiredService<T>() where T : class;
member this.GetRequiredService : unit -> 'T (requires 'T : null)
Public Function GetRequiredService(Of T As Class) () As T
Type Parameters
- T
The type of service to resolve.
Returns
An instance of the specified service, or null
.
Exceptions
Thrown if the current Ioc instance has not been initialized, or if the requested service type was not registered in the service provider currently in use.