LinqExtensions.

MergeMap<TSource, TResult>(IEnumerable<TSource>, Func<TSource, IEnumerable<TResult>>) Method

Summary

Projects each element of a sequence to an System.Collections.Generic.IEnumerable`1 and flattens the resulting sequences into one sequence.

Syntax

public static IEnumerable<TResult> MergeMap<TSource, TResult>(this IEnumerable<TSource> source, Func<TSource, IEnumerable<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 IEnumerable<TSource> A sequence of values to project.
selector Func<TSource, IEnumerable<TResult>> A transform function to apply to each element.

Return Value

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