<PackageReference Include="ReactiveUI.Primitives.Core" Version="8.3.0" />

ReactiveUI.Primitives.Signals.StateSignal<T>

public sealed class StateSignal<T> : ISignal<T>, ISignal<T, T>, IObserver<T>, IObservable<T>, IsDisposed, IDisposable, IWitnessRemovable<T>
Mutable latest-value signal with a ReactiveUI.Primitives name for reactive-property parity.
public IObservable<T> Changed { get; }

Gets the observable stream of current and subsequent values.

public bool HasObservers { get; }

Gets a value indicating whether this instance has observers.

public bool IsDisposed { get; }

Gets a value indicating whether this instance is disposed.

public T Value { get; set; }

Gets or sets the current value, notifying observers on every assignment even when the value is unchanged.

public StateSignal(T initialValue)

Initializes a new instance of the StateSignal<T> class.

public void Dispose()

Releases the signal's observers and cached state.

public void OnCompleted()

Notifies all subscribed observers about the end of the sequence.

public void OnError(Exception error)

Notifies all subscribed observers about the exception.

public void OnNext(T value)

Notifies all subscribed observers about the arrival of the specified element in the sequence.

public void Refresh()

Emits the current value again without changing it.

public IDisposable Subscribe(IObserver<T> observer)

Subscribes an observer to the signal.

public ProjectedReadOnlyState<T, TResult> ToReadOnlyState<TResult>(Func<T, TResult> selector)

Creates a read-only projected state view that tracks this state until disposed.

public bool TryGetValue(out T value)

Tries to get the current value, returning false when disposed.