AsyncLinqExtensions.

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

Summary

Projects each element of a sequence to an System.Collections.Generic.IAsyncEnumerable`1, flattens the resulting sequences into one sequence, and invokes a result selector function on each element therein.

Syntax

public static IAsyncEnumerable<TResult> MergeMap<TSource, TCollection, TResult>(this IAsyncEnumerable<TSource> source, Func<TSource, IAsyncEnumerable<TCollection>> collectionSelector, Func<TSource, TCollection, TResult> resultSelector)

Type Parameters

Name Description
TSource The type of the elements of source.
TCollection The type of the intermediate elements collected by collectionSelector.
TResult The type of the elements of the resulting sequence.

Parameters

Name Type Description
source IAsyncEnumerable<TSource> A sequence of values to project.
collectionSelector Func<TSource, IAsyncEnumerable<TCollection>> A transform function to apply to each element of the input sequence.
resultSelector Func<TSource, TCollection, TResult> A transform function to apply to each element of the intermediate sequence.

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 collectionSelector on each element of source and then mapping each of those sequence elements and their corresponding source element to a result element.