Builds a new collection by applying a function to all elements of this list and using the elements of the resulting collections (same as SelectMany).

Namespace: Flinq
Assembly: Flinq (in Flinq.dll) Version: 1.0.2.0 (1.0.2.0)

Syntax

C#
public static IEnumerable<B> FlatMap<A, B>(
	this IEnumerable<A> source,
	Func<A, IEnumerable<B>> f
)

Parameters

source
Type: System.Collections.Generic..::..IEnumerable<(Of <(<'A>)>)>
The input sequence.
f
Type: System..::..Func<(Of <(<'A, IEnumerable<(Of <(<'B>)>)>>)>)>
The function to apply to each element.

Type Parameters

A
The type of the elements in the input sequence.
B
The element type of the returned collection.

Return Value

Type: IEnumerable<(Of <(<'B>)>)>
The output sequence.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable<(Of <(<'A>)>)>. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

See Also