Click or drag to resize
DigitalRuneTreeHelperGetSubtreeT Method (T, FuncT, IEnumerableT)
Gets the subtree (the given node and all of its descendants) using a depth-first search.

Namespace: DigitalRune.Linq
Assembly: DigitalRune (in DigitalRune.dll) Version: 1.20.0.0 (1.20.1.14552)
Syntax
public static IEnumerable<T> GetSubtree<T>(
	T node,
	Func<T, IEnumerable<T>> getChildren
)
where T : class

Parameters

node
Type: T
The reference node where to start the search. (The reference node will be the first element in the enumeration.)
getChildren
Type: SystemFuncT, IEnumerableT

A method that retrieves the children of an object of type T.

GetSubtreeT(T, FuncT, IEnumerableT) guarantees that getChildren is never called with as parameter. The enumeration returned by getChildren may contain .

Type Parameters

T
The type of node that is enumerated.

Return Value

Type: IEnumerableT
The subtree of node.
Exceptions
ExceptionCondition
ArgumentNullExceptionnode is .
ArgumentNullExceptiongetChildren is .
Remarks
This method can be used to traverse a tree in depth-first order (preorder).
See Also