Class ServiceObserver<T>
Helper class to be notified when a service is initialized
Implements
Inherited Members
Namespace: Unity.Services.Core
Assembly: Unity.Services.Core.dll
Syntax
public class ServiceObserver<T> : IDisposable
Type Parameters
Name | Description |
---|---|
T | The service to be observed |
Constructors
ServiceObserver()
Create an observer for a specific service interface to be notified when a service is initialized. This observes the global service registry.
Declaration
public ServiceObserver()
ServiceObserver(IUnityServices)
Create an observer for a specific service interface to be notified when a service is initialized
Declaration
public ServiceObserver(IUnityServices registry)
Parameters
Type | Name | Description |
---|---|---|
IUnityServices | registry | The service registry to observe |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if the provided registry is invalid |
Properties
Service
Access to the service once initialized
Declaration
public T Service { get; }
Property Value
Type | Description |
---|---|
T |
Methods
Dispose()
Unregisters event and resets registry
Declaration
public void Dispose()
Events
Initialized
Event raised once the service is initialized
Declaration
public event Action<T> Initialized
Event Type
Type | Description |
---|---|
Action<T> |