Skip to content

M_CodeJam_Collections_EnumerableExtensions_Flatten__1

andrewvk edited this page Mar 29, 2016 · 7 revisions

EnumerableExtensions.Flatten(T) Method

[This is preliminary documentation and is subject to change.]

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: 1.0.0.0 (1.0.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

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