Skip to content

BreadthFirstTraversal<TNode>.Enumerate Method ​

Definition ​

Enumerates over a node and its descendants.

c#
public IEnumerable<TNode> Enumerate(TNode root, bool includeRoot = true, Func<TNode, bool>? shouldEnumerateDescendants = null);

Parameters ​

NameTypeDescription
rootTNodeThe root node to enumerate over.
includeRootBooleanWhether to include root in the results or not. Defaults to true.
shouldEnumerateDescendantsFunc<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 ​

IEnumerable<TNode>

A lazy IEnumerable<T> of the descendants.