namespace Spectre.Console { /// /// Contains extension methods for . /// public static class HasTreeNodeExtensions { /// /// Adds a child to the end of the node's list of children. /// /// An object type with tree nodes. /// The object that has tree nodes. /// Child to be added. /// The same instance so that multiple calls can be chained. public static T AddChild(this T obj, TreeNode child) where T : class, IHasTreeNodes { if (obj is null) { throw new System.ArgumentNullException(nameof(obj)); } obj.Children.Add(child); return obj; } } }