Skip to content

BreadthFirstTraversal<TNode>.Enumerate Method

Definition

Enumerates over a node and its descendants.

public IEnumerable<TNode> Enumerate(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

IEnumerable<TNode>

A lazy IEnumerable<T> of the descendants.