Extension helpers¶
View model code keeps needing the same few helpers: drop null values, retry with a delay, notice a stream that has
gone quiet, or block a test until a value arrives. These helpers ship in the ReactiveUI.Primitives package that
ReactiveUI is built on, so there is nothing extra to install.
Add a using ReactiveUI.Primitives.Extensions; directive to reach them. The helpers are documented, each with an
example, in the Primitives section:
| You want to | Helpers | Page |
|---|---|---|
Filter or reshape values, such as dropping null, combining bool streams or batching until a condition holds | WhereIsNotNull, SkipWhileNull, WhereTrue, WhereFalse, AsSignal, LatestOrDefault, BufferUntil, CombineLatestValuesAreAllTrue | Values |
| Wait for a pause, or spot a quiet stream | BufferUntilIdle, ThrottleDistinct, DetectStale, Heartbeat | Timing |
| Retry and recover | RetryWithDelay, CatchAndReturn | Errors |
| Run async work for each value, or turn a stream into a task | SelectAsync, SelectLatestAsync, SubscribeAsync, ToHotTask | Tasks |
| Hold state, or block a test until a value arrives | WaitForValue, WaitForError, WaitForCompletion, SubscribeGetValue | State and testing |
The overview, extension helpers, walks through a first helper.
Streams where the sender waits for each subscriber, IObservableAsync<T>, have their own operators in the
ReactiveUI.Primitives.Async package. See async streams.
Code that uses System.Reactive's types gets the same helpers from the ReactiveUI.Primitives.Reactive package. See
the short version.