Table of Contents

Class DefaultIfEmptyOperator

Namespace
RxSharp.Operators
Assembly
RxSharp.dll

Implements the DefaultIfEmpty operator. Mirrors rxjs's defaultIfEmpty.

public static class DefaultIfEmptyOperator
Inheritance
System.Object
DefaultIfEmptyOperator

Methods

DefaultIfEmpty<T>(Observable<T>, T)

Mirrors source, but if it completes without ever emitting a value, emits defaultValue first.

public static Observable<T> DefaultIfEmpty<T>(this Observable<T> source, T defaultValue)

Parameters

source Observable<T>

The source observable to monitor for emptiness.

defaultValue T

The value to emit if source completes without emitting anything.

Returns

Observable<T>

An observable that mirrors source, substituting defaultValue when it would otherwise complete empty.

Type Parameters

T

The element type of the source observable and the default value.