ReactiveUI.Primitives.Extensions.CurrentValueSubject<T>
Thread-safe subject that holds the most-recently-emitted value, replays it to new subscribers,
and broadcasts subsequent emissions. Per-emission hot path:
Lock taken only to read the current observer state and update the cached value.Single-observer state lives in a dedicated field — no array allocated for the common case.Multi-observer state uses a copy-on-write IObserver{T}[] snapshot iterated outside the lock.
namespace ReactiveUI.Primitives.Extensions
{
public sealed class CurrentValueSubject<[System.Runtime.CompilerServices.Nullable(2)] T> : IObservable<T>, IObserver<T>, IDisposable
{
public T Value { get; }
public CurrentValueSubject(T initialValue);
public void OnNext(T value);
public void OnError(Exception error);
public void OnCompleted();
public IDisposable Subscribe(IObserver<T> observer);
public IObservable<T> AsObservable();
public void Dispose();
}
}