Skip to content

DepthFirstPreOrderTraversal<TNode>.Enumerate Method

Definition

Enumerates over a node and its descendents.

public IEnumerable<TNode> Enumerate(TNode root, bool includeRoot = true, Func<TNode, bool>? shouldEnumerateDescendents = 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.
shouldEnumerateDescendents Func<TNode, Boolean> Optional function to specify whether the descendents of a given node should be included or not. If not provided then all descendents will be included.

Returns

IEnumerable<TNode>

A lazy IEnumerable<T> of the descendents.