TryRegisterService<T>(Func<T>)
Registers the factory of a service of type T unless a factory is already registered for this type, without running
the registered factory. A library uses it to provide a default that the application can replace, before or after.
Declaration
public static bool TryRegisterService<T>(Func<T> factory)Parameters
| Type | Name | Description |
|---|---|---|
| Func<T> | factory | A delegate that returns the service. It runs each time the service is resolved. |
Returns
| Type | Description |
|---|---|
| bool |
|
Type Parameters
| Name | Description |
|---|---|
| T | The type of the service, as requested by the code that resolves it. |