EnumerableExtensionsFlattenFromRootToLeavesT(T, 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.CollectionsAssembly: AltaxoCore (in AltaxoCore.dll) Version: 4.8.3448.0 (4.8.3448.0)
Syntaxpublic static IEnumerable<T> FlattenFromRootToLeaves<T>(
T root,
Func<T, IEnumerable<T>?> recursion
)
Parameters
- root T
- The root element 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
- Type of the elements.
Return Value
IEnumerableTIterator that enumerates the tree structure in preorder.
See Also