Click or drag to resize
DigitalRuneTreeHelperGetDepthT Method
Gets the depth of the specified node in a tree.

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

Parameters

node
Type: T
The node.
getParent
Type: SystemFuncT, T

A method that retrieves the parent object for a node of type T.

The method should return to indicate that a node does not have a parent. GetDepthT(T, FuncT, T) guarantees that getParent is never called with as parameter.

Type Parameters

T
The type of tree node.

Return Value

Type: Int32
The depth of the node.
Exceptions
ExceptionCondition
ArgumentNullExceptionnode is .
ArgumentNullExceptiongetParent is .
Remarks
The depth of a node is the length of the longest upward path to the root. A root node has a depth of 0.
See Also