Kernel.GetRequiredService<T>(Object) 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.
Gets a required service from the Services provider.
public T GetRequiredService<T> (object? serviceKey = default) where T : class;
member this.GetRequiredService : obj -> 'T (requires 'T : null)
Public Function GetRequiredService(Of T As Class) (Optional serviceKey As Object = Nothing) As T
Type Parameters
- T
Specifies the type of the service to get.
Parameters
- serviceKey
- Object
An object that specifies the key of the service to get.
Returns
T
The found service instance.
Exceptions
A service of the specified type and name could not be found.