Class ServiceProviderExtensions
Extension methods for IServiceProvider.
Inherited Members
Namespace: Unity.AppUI.MVVM
Assembly: Unity.AppUI.MVVM.dll
Syntax
public static class ServiceProviderExtensions
Methods
GetRequiredService<T>(IServiceProvider)
Gets a service from the service provider. Throws an exception if the service is not found.
Declaration
public static T GetRequiredService<T>(this IServiceProvider serviceProvider) where T : class
Parameters
Type | Name | Description |
---|---|---|
IServiceProvider | serviceProvider | The service provider. |
Returns
Type | Description |
---|---|
T | The service. |
Type Parameters
Name | Description |
---|---|
T | The type of the service. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when |
GetService<T>(IServiceProvider)
Gets a service from the service provider.
Declaration
public static T GetService<T>(this IServiceProvider serviceProvider) where T : class
Parameters
Type | Name | Description |
---|---|---|
IServiceProvider | serviceProvider | The service provider. |
Returns
Type | Description |
---|---|
T | The service. |
Type Parameters
Name | Description |
---|---|
T | The type of the service. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when |