Skip to content

M_CodeJam_Collections_EnumerableExtensions_Flatten__1

Andrew Koryavchenko edited this page Jun 17, 2018 · 7 revisions

EnumerableExtensions.Flatten(T) Method

Returns a flattened sequence from a graph or hierarchy of elements by using the specified children selector.

Namespace: CodeJam.Collections
Assembly: CodeJam (in CodeJam.dll) Version: 2.1.0.0

Syntax

C#

public static IEnumerable<T> Flatten<T>(
	this IEnumerable<T> source,
	Func<T, IEnumerable<T>> childrenSelector
)

VB

<ExtensionAttribute>
Public Shared Function Flatten(Of T) ( 
	source As IEnumerable(Of T),
	childrenSelector As Func(Of T, IEnumerable(Of T))
) As IEnumerable(Of T)

F#

[<ExtensionAttribute>]
static member Flatten : 
        source : IEnumerable<'T> * 
        childrenSelector : Func<'T, IEnumerable<'T>> -> IEnumerable<'T> 

Parameters

 

source
Type: System.Collections.Generic.IEnumerable(T)
The source hierarchy to flatten.
childrenSelector
Type: System.Func(T, IEnumerable(T))
A function used to retrieve the children of an element.

Type Parameters

 

T
[Missing documentation for "M:CodeJam.Collections.EnumerableExtensions.Flatten1(System.Collections.Generic.IEnumerable{0},System.Func{0,System.Collections.Generic.IEnumerable{0}})"]

Return Value

Type: IEnumerable(T)
A flat sequence of elements produced from the elements in the source hierarchy.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable(T). 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

Reference

EnumerableExtensions Class
CodeJam.Collections Namespace

Clone this wiki locally