Class FilterOperator
Implements the Filter operator. Mirrors rxjs's filter.
public static class FilterOperator
- Inheritance
-
System.ObjectFilterOperator
Methods
Filter<T>(Observable<T>, Func<T, bool>)
Emits only the values from source for which predicate returns true.
public static Observable<T> Filter<T>(this Observable<T> source, Func<T, bool> predicate)
Parameters
sourceObservable<T>The source observable to filter.
predicateFunc<T, bool>A function that tests each value.
Returns
- Observable<T>
An observable of the values from
sourcethat satisfypredicate.
Type Parameters
TThe element type of the source observable.
Remarks
Equivalent to the indexed overload with the index ignored. If predicate throws, the exception is forwarded via OnError.
Filter<T>(Observable<T>, Func<T, int, bool>)
Emits only the values from source for which predicate, called with
the value and its zero-based emission index, returns true.
public static Observable<T> Filter<T>(this Observable<T> source, Func<T, int, bool> predicate)
Parameters
sourceObservable<T>The source observable to filter.
predicateFunc<T, int, bool>A function that tests each value together with its index since subscription.
Returns
- Observable<T>
An observable of the values from
sourcethat satisfypredicate.
Type Parameters
TThe element type of the source observable.
Remarks
If predicate throws, the exception is forwarded via OnError and the source subscription is torn down.