Skip to main content

UIServiceContainerExtensions.GetRequiredService<T>(IUIServiceContainer, String) Method

Gets the service from the specified IUIServiceContainer. If the required service is not found, the method throws an exception.

Namespace: DevExpress.Maui.Mvvm

Assembly: DevExpress.Maui.Mvvm.dll

NuGet Package: DevExpress.Maui.Mvvm

Declaration

public static T GetRequiredService<T>(
    this IUIServiceContainer container,
    string key = null
)
    where T : class

Parameters

Name Type Description
container IUIServiceContainer

The source container that hosts services.

Optional Parameters

Name Type Default Description
key String null

The key that identifies the required service instance when multiple services of the same type are registered.

Type Parameters

Name Description
T

The service type.

Returns

Type Description
T

The required service as the object of the T type. If the service is not found in the container, the method throws an exception.

See Also