Summary
Projects each element of an observable sequence to a task with cancellation support and merges all of the task results into one observable sequence.
Syntax
public static IObservable<TResult> SwitchMap<TSource, TResult>(this IObservable<TSource> source, Func<TSource, CancellationToken, Task<TResult>> selector)
Type Parameters
Name |
Description |
TSource |
The type of the elements in the source sequence. |
TResult |
The type of the result produced by the projected tasks and the elements in the merged result sequence. |
Parameters
Name |
Type |
Description |
source |
IObservable<TSource> |
An observable sequence of elements to project. |
selector |
Func<TSource, CancellationToken, Task<TResult>> |
A transform function to apply to each element. |
Return Value
Type |
Description |
IObservable<TResult> |
An observable sequence whose elements are the result of the tasks executed for each element of the input sequence. |