Class FindOperator
Implements the Find operator. Mirrors rxjs's find.
public static class FindOperator
- Inheritance
-
System.ObjectFindOperator
Methods
Find<T>(Observable<T>, Func<T, bool>)
Emits only the first value from source that satisfies predicate, then
completes.
public static Observable<T?> Find<T>(this Observable<T> source, Func<T, bool> predicate)
Parameters
sourceObservable<T>The source observable to search.
predicateFunc<T, bool>A function that tests each value.
Returns
- Observable<T>
An observable of the first matching value (or default if none is found), then completes.
Type Parameters
TThe element type of the source observable.
Remarks
Unlike First(predicate), if no value satisfies predicate before source
completes, the result emits default and completes normally instead of erroring. If
predicate throws, the exception is forwarded via OnError.
Find<T>(Observable<T>, Func<T, int, bool>)
Emits only the first value from source that satisfies predicate
(called with the value and its zero-based emission index), then completes.
public static Observable<T?> Find<T>(this Observable<T> source, Func<T, int, bool> predicate)
Parameters
sourceObservable<T>The source observable to search.
predicateFunc<T, int, bool>A function that tests each value together with its index since subscription.
Returns
- Observable<T>
An observable of the first matching value (or default if none is found), then completes.
Type Parameters
TThe element type of the source observable.
Remarks
Unlike First(predicate), if no value satisfies predicate before source
completes, the result emits default and completes normally instead of erroring. If
predicate throws, the exception is forwarded via OnError.