Table of Contents

Class FindOperator

Namespace
RxSharp.Operators
Assembly
RxSharp.dll

Implements the Find operator. Mirrors rxjs's find.

public static class FindOperator
Inheritance
System.Object
FindOperator

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

source Observable<T>

The source observable to search.

predicate Func<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

T

The 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

source Observable<T>

The source observable to search.

predicate Func<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

T

The 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.