Skip to content
ConsoleMonster

API Reference

Class

TreeHierarchy

Namespace ConsoleMonster.Widgets
Assembly ConsoleMonster
Modifiers static

Builds tree nodes from hierarchical objects (groups and members, folders and files, an org chart): a function gives each item's node and another its children. Depth, width and size limits keep a large or cyclic hierarchy readable and bounded; what is left out is marked in the tree instead of being dropped silently.

Inheritance

  • Object
  • TreeHierarchy

Methods

public static Int32 Add<T>(TreeNode parent, IEnumerable<T?> items, Func<T?, TreeNode> node, Func<T?, IEnumerable<T?>?> children, TreeHierarchyOptions? options = null) #
Returns: Int32

Adds the items and their descendants under a node.

Type Parameters

T
The item type.

Parameters

parent ConsoleMonster.Widgets.TreeNode requiredposition: 0
The node to add to (for example Tree.Root).
items System.Collections.Generic.IEnumerable<T?> requiredposition: 1
The top-level items.
node System.Func<T?, ConsoleMonster.Widgets.TreeNode> requiredposition: 2
Creates the node for an item (its label, status and note); children are added by the walk.
children System.Func<T?, System.Collections.Generic.IEnumerable<T?>?> requiredposition: 3
The children of an item, or null when it has none.
options ConsoleMonster.Widgets.TreeHierarchyOptions? = null optionalposition: 4
The limits, or null for the defaults.

Returns

The number of item nodes added (limit notes not counted).