Class FindIndexOperator
Implements the FindIndex operator. Mirrors rxjs's findIndex.
public static class FindIndexOperator
- Inheritance
-
System.ObjectFindIndexOperator
Methods
FindIndex<T>(Observable<T>, Func<T, bool>)
Emits only the zero-based index of the first value from source that satisfies
predicate, then completes.
public static Observable<int> FindIndex<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<int>
An observable of the index of the first matching value, or
-1if none is found.
Type Parameters
TThe element type of the source observable.
Remarks
Like Find<T>(Observable<T>, Func<T, bool>), but emits the index of the match
instead of the value itself. If no value satisfies predicate before source
completes, the result emits -1 and completes normally (no error). If predicate
throws, the exception is forwarded via OnError.
FindIndex<T>(Observable<T>, Func<T, int, bool>)
Emits only the zero-based index of the first value from source that satisfies
predicate (called with the value and its zero-based emission index), then completes.
public static Observable<int> FindIndex<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<int>
An observable of the index of the first matching value, or
-1if none is found.
Type Parameters
TThe element type of the source observable.
Remarks
Like Find<T>(Observable<T>, Func<T, int, bool>), but emits the index of the
match instead of the value itself. If no value satisfies predicate before source
completes, the result emits -1 and completes normally (no error). If predicate
throws, the exception is forwarded via OnError.