AsyncLinqExtensions.

MergeMap<TSource, TResult>(IAsyncEnumerable<TSource>, Func<TSource, int, IAsyncEnumerable<TResult>>) Method

Summary

Projects each element of a sequence to an System.Collections.Generic.IAsyncEnumerable`1, and flattens the resulting sequences into one sequence. The index of each source element is used in the projected form of that element.

Syntax

public static IAsyncEnumerable<TResult> MergeMap<TSource, TResult>(this IAsyncEnumerable<TSource> source, Func<TSource, int, IAsyncEnumerable<TResult>> selector)

Type Parameters

Name Description
TSource The type of the elements of source.
TResult The type of the elements of the sequence returned by selector.

Parameters

Name Type Description
source IAsyncEnumerable<TSource> A sequence of values to project.
selector Func<TSource, int, IAsyncEnumerable<TResult>> A transform function to apply to each source element; the second parameter of the function represents the index of the source element.

Return Value

Type Description
IAsyncEnumerable<TResult> An System.Collections.Generic.IAsyncEnumerable`1 whose elements are the result of invoking the one-to-many transform function on each element of an input sequence.