Node<TNode>.Traverse.DepthFirstPreOrder Method ​
Definition ​
Enumerates over a node and its descendants depth first, pre-order.
c#
public static IEnumerable<TNode> DepthFirstPreOrder(TNode root, bool includeRoot = true, Func<TNode, bool>? shouldEnumerateDescendants = null);Parameters ​
| Name | Type | Description |
|---|---|---|
root | TNode | The root node to enumerate over. |
includeRoot | Boolean | Whether to include root in the results or not. Defaults to true. |
shouldEnumerateDescendants | Func<TNode, Boolean> | Optional function to specify whether the descendants of a given node should be included or not. If not provided then all descendants will be included. |
Returns ​
A lazy IEnumerable<T> of the descendants in depth first pre-order.