)} ,System.Func{--0,System.Boolean})}
Observable.Count(IObservable) method¶
Defined in
Type: Observable
Namespace: System.Reactive.Linq
Assembly: System.Reactive.dll
Applies to
netstandard2.0
Overloads¶
- 1.
public static IObservable<int> Count<TSource>(this IObservable<TSource> source) - 2.
public static IObservable<int> Count<TSource>(this IObservable<TSource> source, Func<TSource, bool> predicate)
1. Overload¶
public static IObservable<int> Count<TSource>(this IObservable<TSource> source)
Summary: Returns an observable sequence containing an Int32 that represents the total number of elements in an observable sequence.
Type parameters
| Name | Description |
|---|---|
TSource | The type of the elements in the source sequence. |
Parameters
| Name | Type | Description |
|---|---|---|
source | IObservable | An observable sequence that contains elements to be counted. |
Returns: IObservable
Remarks
The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | source is null. |
| System.OverflowException | (Asynchronous) The number of elements in the source sequence is larger than MaxValue. |
2. Overload¶
public static IObservable<int> Count<TSource>(this IObservable<TSource> source, Func<TSource, bool> predicate)
Summary: Returns an observable sequence containing an Int32 that represents how many elements in the specified observable sequence satisfy a condition.
Type parameters
| Name | Description |
|---|---|
TSource | The type of the elements in the source sequence. |
Parameters
| Name | Type | Description |
|---|---|---|
source | IObservable | An observable sequence that contains elements to be counted. |
predicate | Func | A function to test each element for a condition. |
Returns: IObservable
Remarks
The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | source or predicate is null. |