Class CountOperator
Implements the Count operator. Mirrors rxjs's count.
public static class CountOperator
- Inheritance
-
System.ObjectCountOperator
Methods
Count<T>(Observable<T>)
Emits a single integer: the total number of values emitted by source, once it completes.
public static Observable<int> Count<T>(this Observable<T> source)
Parameters
sourceObservable<T>The source observable to count.
Returns
- Observable<int>
An observable that emits the total value count, then completes.
Type Parameters
TThe element type of the source observable.
Count<T>(Observable<T>, Func<T, bool>)
Emits a single integer: the number of values emitted by source that satisfy
predicate, once source completes.
public static Observable<int> Count<T>(this Observable<T> source, Func<T, bool> predicate)
Parameters
sourceObservable<T>The source observable to count.
predicateFunc<T, bool>A function that tests each value; only matching values are counted.
Returns
- Observable<int>
An observable that emits the matching value count, then completes.
Type Parameters
TThe element type of the source observable.
Remarks
If predicate throws, the exception is forwarded via OnError.
Count<T>(Observable<T>, Func<T, int, bool>)
Emits a single integer: the number of values emitted by source that satisfy
predicate (called with the value and its zero-based emission index), once
source completes.
public static Observable<int> Count<T>(this Observable<T> source, Func<T, int, bool> predicate)
Parameters
sourceObservable<T>The source observable to count.
predicateFunc<T, int, bool>A function that tests each value together with its index since subscription; only matching values are counted.
Returns
- Observable<int>
An observable that emits the matching value count, then completes.
Type Parameters
TThe element type of the source observable.
Remarks
If predicate throws, the exception is forwarded via OnError.