Table of Contents

ObservableAction Constructor

ObservableAction(Action<Action<T>>, Action<Action<T>>)

public ObservableAction(Action<Action<T>> sub, Action<Action<T>> unsub)

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;

Parameters

sub Action<Action<T>>
unsub Action<Action<T>>