)} ,System.Func{--0,System.Boolean})}
Observable.SingleOrDefault(IObservable) method¶
Defined in
Type: Observable
Namespace: System.Reactive.Linq
Assembly: System.Reactive.dll
Applies to
net8.0, net8.0-windows10.0.19041, net8.0-ios17.5, net8.0-maccatalyst17.5, net8.0-macos14.2, net8.0-macos14.5, net8.0-tvos17.2, netstandard2.0
Overloads¶
- 1.
public static TSource SingleOrDefault<TSource>(this IObservable<TSource> source) - 2.
public static TSource SingleOrDefault<TSource>(this IObservable<TSource> source, Func<TSource, bool> predicate)
1. Overload¶
Deprecated
This blocking operation is no longer supported. Instead, use the async version in combination with C# and Visual Basic async/await support. In case you need a blocking operation, use Wait or convert the resulting observable sequence to a Task object and block.
Attributes: [Obsolete("This blocking operation is no longer supported. Instead, use the async version in combination with C# and Visual Basic async/await support. In case you need a blocking operation, use Wait or convert the resulting observable sequence to a Task object and block.")]
public static TSource SingleOrDefault<TSource>(this IObservable<TSource> source)
Type parameters
| Name | Description |
|---|---|
TSource | -- |
Parameters
| Name | Type | Description |
|---|---|---|
source | IObservable | -- |
Returns: TSource
2. Overload¶
Deprecated
This blocking operation is no longer supported. Instead, use the async version in combination with C# and Visual Basic async/await support. In case you need a blocking operation, use Wait or convert the resulting observable sequence to a Task object and block.
Attributes: [Obsolete("This blocking operation is no longer supported. Instead, use the async version in combination with C# and Visual Basic async/await support. In case you need a blocking operation, use Wait or convert the resulting observable sequence to a Task object and block.")]
public static TSource SingleOrDefault<TSource>(this IObservable<TSource> source, Func<TSource, bool> predicate)
Type parameters
| Name | Description |
|---|---|
TSource | -- |
Parameters
| Name | Type | Description |
|---|---|---|
source | IObservable | -- |
predicate | Func | -- |
Returns: TSource