)} ,System.Linq.Expressions.Expression})}
Qbservable.SingleAsync(IQbservable) method¶
Defined in
Type: Qbservable
Namespace: System.Reactive.Linq
Assembly: System.Reactive.dll
Applies to
netstandard2.0
Overloads¶
- 1.
public static IQbservable<TSource> SingleAsync<TSource>(this IQbservable<TSource> source) - 2.
public static IQbservable<TSource> SingleAsync<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, bool>> predicate)
1. Overload¶
public static IQbservable<TSource> SingleAsync<TSource>(this IQbservable<TSource> source)
Summary: Returns the only element of an observable sequence, and reports an exception if there is not exactly one element in the observable sequence.
Type parameters
| Name | Description |
|---|---|
TSource | The type of the elements in the source sequence. |
Parameters
| Name | Type | Description |
|---|---|---|
source | [IQbservable | Source observable sequence. |
Returns: IQbservable
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | source is null. |
| System.InvalidOperationException | (Asynchronous) The source sequence contains more than one element. -or- The source sequence is empty. |
2. Overload¶
public static IQbservable<TSource> SingleAsync<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, bool>> predicate)
Summary: Returns the only element of an observable sequence that satisfies the condition in the predicate, and reports an exception if there is not exactly one element in the observable sequence.
Type parameters
| Name | Description |
|---|---|
TSource | The type of the elements in the source sequence. |
Parameters
| Name | Type | Description |
|---|---|---|
source | [IQbservable | Source observable sequence. |
predicate | Expression | A predicate function to evaluate for elements in the source sequence. |
Returns: IQbservable
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | source or predicate is null. |
| System.InvalidOperationException | (Asynchronous) No element satisfies the condition in the predicate. -or- More than one element satisfies the condition in the predicate. -or- The source sequence is empty. |