Class ThrowIfEmptyOperator
Extension methods implementing the throwIfEmpty operator.
public static class ThrowIfEmptyOperator
- Inheritance
-
System.ObjectThrowIfEmptyOperator
Methods
ThrowIfEmpty<T>(Observable<T>, Func<Exception>?)
Mirrors source, but if it completes without ever emitting a value, the output errors
instead of completing. If at least one value was emitted, the output completes normally.
public static Observable<T> ThrowIfEmpty<T>(this Observable<T> source, Func<Exception>? errorFactory = null)
Parameters
sourceObservable<T>The source sequence.
errorFactoryFunc<Exception>?An optional factory invoked to create the exception to emit if
sourcecompletes without emitting a value. Defaults to a new EmptyErrorException.
Returns
- Observable<T>
An observable that mirrors
source, except that an empty completion is replaced with an error produced byerrorFactory.
Type Parameters
TThe type of values emitted by
source.