Skip to content

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 toHelpersPage
Filter or reshape values, such as dropping null, combining bool streams or batching until a condition holdsWhereIsNotNull, SkipWhileNull, WhereTrue, WhereFalse, AsSignal, LatestOrDefault, BufferUntil, CombineLatestValuesAreAllTrueValues
Wait for a pause, or spot a quiet streamBufferUntilIdle, ThrottleDistinct, DetectStale, HeartbeatTiming
Retry and recoverRetryWithDelay, CatchAndReturnErrors
Run async work for each value, or turn a stream into a taskSelectAsync, SelectLatestAsync, SubscribeAsync, ToHotTaskTasks
Hold state, or block a test until a value arrivesWaitForValue, WaitForError, WaitForCompletion, SubscribeGetValueState 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.

Last updated Contributors: Glenn Watson