using System; namespace Spectre.Console { /// /// Contains extension methods for . /// public static class TreeNodeExtensions { /// /// Expands the tree. /// /// The tree node. /// The same instance so that multiple calls can be chained. public static TreeNode Expand(this TreeNode node) { return Expand(node, true); } /// /// Collapses the tree. /// /// The tree node. /// The same instance so that multiple calls can be chained. public static TreeNode Collapse(this TreeNode node) { return Expand(node, false); } /// /// Sets whether or not the tree node should be expanded. /// /// The tree node. /// Whether or not the tree node should be expanded. /// The same instance so that multiple calls can be chained. public static TreeNode Expand(this TreeNode node, bool expand) { if (node is null) { throw new ArgumentNullException(nameof(node)); } node.Expanded = expand; return node; } } }