ObservableAction<T> Struct
- Namespace
- SatorImaging.UnityFundamentals
public readonly struct ObservableAction<T> : IObservableAction<T>, IObservable<T>, IDisposable, IEquatable<ObservableAction<T>>
Type Parameters
T
- Implements
-
IObservable<T>
- Inherited Members
- Extension Methods
Constructors
- ObservableAction(Action<Action<T>>, Action<Action<T>>)
Create IObservable<T> with sub (
+=
) and unsub (-=
)public ObservableAction<T> MyEvent => new(x => _backingEventField += x, x => _backingEventField -= x); // adding `event` to backing field will make it thread-safe (not only for preventing access from externals) event Action<T>? _backingEventField;
Methods
- Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
- Equals(ObservableAction<T>)
Indicates whether the current object is equal to another object of the same type.
- Equals(object?)
Indicates whether this instance and a specified object are equal.
- GetHashCode()
Returns the hash code for this instance.
Operators
Explicit Interface Implementations
- IObservable<T>.Subscribe(IObserver<T>)
Notifies the provider that an observer is to receive notifications.