Click or drag to resize

EnumerableExtensionsFlattenFromRootToLeavesT(IEnumerableT, FuncT, IEnumerableT) Method

Converts a recursive data structure into a flat list. The root element is enumerated before its corresponding child element(s).

Namespace: Altaxo.Collections
Assembly: AltaxoCore (in AltaxoCore.dll) Version: 4.8.3179.0 (4.8.3179.0)
Syntax
C#
public static IEnumerable<T> FlattenFromRootToLeaves<T>(
	this IEnumerable<T> input,
	Func<T, IEnumerable<T>?> recursion
)

Parameters

input  IEnumerableT
The root elements of the recursive data structure.
recursion  FuncT, IEnumerableT
The function that gets the children of an element. If no children of an element exist, the function is allowed to return null.

Type Parameters

T

[Missing <typeparam name="T"/> documentation for "M:Altaxo.Collections.EnumerableExtensions.FlattenFromRootToLeaves``1(System.Collections.Generic.IEnumerable{``0},System.Func{``0,System.Collections.Generic.IEnumerable{``0}})"]

Return Value

IEnumerableT
Iterator that enumerates the tree structure in preorder.

Usage Note

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