Back to Devexpress

UIServiceContainerExtensions.GetRequiredService(IUIServiceContainer, Type, String) Method

maui-devexpress-dot-maui-dot-mvvm-dot-uiservicecontainerextensions-dot-getrequiredservice-x28-devexpress-dot-maui-dot-mvvm-dot-iuiservicecontainer-system-dot-type-system-dot-string-x29.md

latest1.6 KB
Original Source

UIServiceContainerExtensions.GetRequiredService(IUIServiceContainer, Type, String) Method

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

Namespace : DevExpress.Maui.Mvvm

Assembly : DevExpress.Maui.Mvvm.dll

NuGet Package : DevExpress.Maui.Mvvm

Declaration

csharp
public static object GetRequiredService(
    this IUIServiceContainer container,
    Type type,
    string key = null
)

Parameters

NameTypeDescription
containerIUIServiceContainer

The source container that hosts services.

| | type | Type |

The service type.

|

Optional Parameters

NameTypeDefaultDescription
keyStringnull

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

|

Returns

TypeDescription
System.Object

The required service. If the service is not found, the method throws an exception.

|

See Also

UIServiceContainerExtensions Class

UIServiceContainerExtensions Members

DevExpress.Maui.Mvvm Namespace