)} ,System.Func{--0,System.Boolean})}
Observable.LastOrDefault(IObservable) method¶
Defined in
Type: Observable
Namespace: System.Reactive.Linq
Assembly: System.Reactive.dll
Applies to
netstandard2.0
Overloads¶
- 1.
public static TSource LastOrDefault<TSource>(this IObservable<TSource> source) - 2.
public static TSource LastOrDefault<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 LastOrDefault<TSource>(this IObservable<TSource> source)
Summary: Returns the last element of an observable sequence, or a default value if no such element exists.
Type parameters
| Name | Description |
|---|---|
TSource | The type of the elements in the source sequence. |
Parameters
| Name | Type | Description |
|---|---|---|
source | IObservable | Source observable sequence. |
Returns: TSource -- The last element in the observable sequence, or a default value if no such element exists.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | source is null. |
See also
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 LastOrDefault<TSource>(this IObservable<TSource> source, Func<TSource, bool> predicate)
Summary: Returns the last element of an observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.
Type parameters
| Name | Description |
|---|---|
TSource | The type of the elements in the source sequence. |
Parameters
| Name | Type | Description |
|---|---|---|
source | IObservable | Source observable sequence. |
predicate | Func | A predicate function to evaluate for elements in the source sequence. |
Returns: TSource -- The last element in the observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | source or predicate is null. |
See also