,System.Func{--0,System.Boolean})} ,System.Func{--0,System.Boolean},System.Threading.CancellationToken)} )} ,System.Threading.CancellationToken)}
ObservableAsync.LastAsync(IObservableAsync, Func) method¶
Defined in
Type: ObservableAsync
Namespace: ReactiveUI.Extensions.Async
Assembly: ReactiveUI.Extensions.dll
Applies to
net10.0, net10.0-browserwasm1.0, net10.0-desktop1.0, net9.0, net9.0-browserwasm1.0, net9.0-desktop1.0, net8.0, net8.0-ios17.5, net8.0-maccatalyst17.5, net8.0-macos14.2, net8.0-macos14.5, net8.0-tvos17.2, netstandard2.1, net462, net481
Overloads¶
- 1.
public static ValueTask<T> LastAsync<T>(this IObservableAsync<T> @this, Func<T, bool> predicate) - 2.
public static ValueTask<T> LastAsync<T>(this IObservableAsync<T> @this, Func<T, bool> predicate, CancellationToken cancellationToken) - 3.
public static ValueTask<T> LastAsync<T>(this IObservableAsync<T> @this) - 4.
public static ValueTask<T> LastAsync<T>(this IObservableAsync<T> @this, CancellationToken cancellationToken)
1. Overload¶
public static ValueTask<T> LastAsync<T>(this IObservableAsync<T> @this, Func<T, bool> predicate)
Summary: Asynchronously returns the last element in the sequence that satisfies the specified predicate.
Type parameters
| Name | Description |
|---|---|
T | The type of elements in the source sequence. |
Parameters
| Name | Type | Description |
|---|---|---|
this | [IObservableAsync | The source observable sequence. |
predicate | Func | A function to test each element for a condition. The method returns the last element for which this predicate returns true. |
Returns: ValueTask
2. Overload¶
public static ValueTask<T> LastAsync<T>(this IObservableAsync<T> @this, Func<T, bool> predicate, CancellationToken cancellationToken)
Summary: Asynchronously returns the last element in the sequence that satisfies the specified predicate.
Type parameters
| Name | Description |
|---|---|
T | The type of elements in the source sequence. |
Parameters
| Name | Type | Description |
|---|---|---|
this | [IObservableAsync | The source observable sequence. |
predicate | Func | A function to test each element for a condition. The method returns the last element for which this predicate returns true. |
cancellationToken | CancellationToken | A cancellation token that can be used to cancel the asynchronous operation. |
Returns: ValueTask
3. Overload¶
public static ValueTask<T> LastAsync<T>(this IObservableAsync<T> @this)
Summary: Asynchronously returns the last element of the sequence.
Type parameters
| Name | Description |
|---|---|
T | The type of elements in the source sequence. |
Parameters
| Name | Type | Description |
|---|---|---|
this | [IObservableAsync | The source observable sequence. |
Returns: ValueTask
Remarks
If the sequence is empty, the behavior depends on the implementation and may result in an exception being thrown. The operation is performed asynchronously and may not complete immediately.
4. Overload¶
public static ValueTask<T> LastAsync<T>(this IObservableAsync<T> @this, CancellationToken cancellationToken)
Summary: Asynchronously returns the last element of the sequence.
Type parameters
| Name | Description |
|---|---|
T | The type of elements in the source sequence. |
Parameters
| Name | Type | Description |
|---|---|---|
this | [IObservableAsync | The source observable sequence. |
cancellationToken | CancellationToken | A cancellation token that can be used to cancel the asynchronous operation. |
Returns: ValueTask
Remarks
If the sequence is empty, the behavior depends on the implementation and may result in an exception being thrown. The operation is performed asynchronously and may not complete immediately.