Click or drag to resize

XEnumerableFlattenTNode Method (IEnumerableTNode, FuncTNode, IEnumerableTNode, TreeTraversalMode)

Returns a flattened sequence from a graph or hierarchy of elements, using the specified children selector, and in the specified traversal order.

Namespace:  Linq.Extras
Assembly:  Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntax
public static IEnumerable<TNode> Flatten<TNode>(
	this IEnumerable<TNode> source,
	Func<TNode, IEnumerable<TNode>> childrenSelector,
	TreeTraversalMode traversalMode
)

Parameters

source
Type: System.Collections.GenericIEnumerableTNode
The source hierarchy to flatten.
childrenSelector
Type: SystemFuncTNode, IEnumerableTNode
The delegate used to retrieve the children of an element.
traversalMode
Type: Linq.ExtrasTreeTraversalMode
The traversal order.

Type Parameters

TNode
The type of the elements in the source hierarchy.

Return Value

Type: IEnumerableTNode
A flat sequence of 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 IEnumerableTNode. 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