,System.Func{--0,System.Threading.CancellationToken,System.Threading.Tasks.ValueTask{--1}})} ,System.Func{--0,--1})}
ObservableAsync.Select(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 IObservableAsync<TDest> Select<T, TDest>(this IObservableAsync<T> @this, Func<T, CancellationToken, ValueTask<TDest>> selector) - 2.
public static IObservableAsync<TDest> Select<T, TDest>(this IObservableAsync<T> @this, Func<T, TDest> selector)
1. Overload¶
public static IObservableAsync<TDest> Select<T, TDest>(this IObservableAsync<T> @this, Func<T, CancellationToken, ValueTask<TDest>> selector)
Summary: Projects each element of the observable sequence into a new form using the specified asynchronous selector function.
Type parameters
| Name | Description |
|---|---|
T | The type of the elements in the source sequence. |
TDest | The type of the value returned by the selector function and produced by the resulting observable sequence. |
Parameters
| Name | Type | Description |
|---|---|---|
this | [IObservableAsync | The source observable sequence. |
selector | Func | A function that transforms each element of the source sequence into a value of type TDest asynchronously. The function receives the source element and a cancellation token. |
Returns: IObservableAsyncTDest containing the results of applying the selector
function to each element of the source sequence.
Remarks
The selector function is invoked for each element as it is observed. If the selector function throws an exception or returns a faulted task, the error is propagated to the observer. The operation supports cancellation via the provided cancellation token.
2. Overload¶
public static IObservableAsync<TDest> Select<T, TDest>(this IObservableAsync<T> @this, Func<T, TDest> selector)
Summary: Projects each element of the observable sequence into a new form using the specified selector function.
Type parameters
| Name | Description |
|---|---|
T | The type of the elements in the source sequence. |
TDest | The type of the value returned by the selector function. |
Parameters
| Name | Type | Description |
|---|---|---|
this | [IObservableAsync | The source observable sequence. |
selector | Func | A function that transforms each element of the source sequence into a new value. Cannot be null. |
Returns: IObservableAsync
Remarks
The selector function is applied to each element as it is observed. If the selector throws an exception, the error is propagated to the observer. This method does not modify the source sequence; it produces a new sequence with transformed elements.