| TreeHelperGetHeightT Method |
Gets the height of the specified tree or subtree.
Namespace: DigitalRune.LinqAssembly: DigitalRune (in DigitalRune.dll) Version: 1.20.0.0 (1.20.1.14552)
Syntax public static int GetHeight<T>(
T tree,
Func<T, IEnumerable<T>> getChildren
)
where T : class
Public Shared Function GetHeight(Of T As Class) (
tree As T,
getChildren As Func(Of T, IEnumerable(Of T))
) As Integer
public:
generic<typename T>
where T : ref class
static int GetHeight(
T tree,
Func<T, IEnumerable<T>^>^ getChildren
)
static member GetHeight :
tree : 'T *
getChildren : Func<'T, IEnumerable<'T>> -> int when 'T : not struct
Parameters
- tree
- Type: T
The root of a tree or subtree. - getChildren
- Type: SystemFuncT, IEnumerableT
A method that retrieves the children of an object of type T.
GetHeightT(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 tree node.
Return Value
Type:
Int32The height of the tree or subtree.
Exceptions Remarks
The height of the tree is the length of the longest downward path to a leaf. A leaf node has
a height of 0.
See Also