Search Results for

    Show / Hide Table of Contents

    Class TreeNode<T>

    Holds an associated Item of type T for this TreeNode, with Children items that are all of type TreeNode<T>

    Inheritance
    object
    BaseHasChildren<TreeNode<T>>
    BaseTreeNode<T, TreeNode<T>>
    TreeNode<T>
    Implements
    ITreeNode<T, TreeNode<T>>
    ITreeNode<T>
    ITreeNode
    IHasChildren<TreeNode<T>>
    IHasChildren
    Inherited Members
    BaseTreeNode<T, TreeNode<T>>.CreateNewItem(T, TreeNode<T>)
    BaseTreeNode<T, TreeNode<T>>.AddChild(T)
    BaseTreeNode<T, TreeNode<T>>.Item
    BaseHasChildren<TreeNode<T>>.AddChild(TreeNode<T>, bool)
    BaseHasChildren<TreeNode<T>>.DeleteChild(TreeNode<T>)
    BaseHasChildren<TreeNode<T>>.ClearChildren()
    BaseHasChildren<TreeNode<T>>.ClearMyParent()
    BaseHasChildren<TreeNode<T>>.AddChild(IHasChildren)
    BaseHasChildren<TreeNode<T>>.DeleteChild(IHasChildren)
    BaseHasChildren<TreeNode<T>>.Order
    BaseHasChildren<TreeNode<T>>.Children
    BaseHasChildren<TreeNode<T>>.Parent
    object.GetType()
    object.MemberwiseClone()
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    Namespace: LemonEdge.Utils
    Assembly: LemonEdge.Utils.dll
    Syntax
    public class TreeNode<T> : BaseTreeNode<T, TreeNode<T>>, ITreeNode<T, TreeNode<T>>, ITreeNode<T>, ITreeNode, IHasChildren<TreeNode<T>>, IHasChildren
    Type Parameters
    Name Description
    T

    The type of the associated Item for this TreeNode

    Remarks

    This TreeNode implements the BaseTreeNode<T, TN> where Type T matches and TN is the TreeNode<T> itself to ensure all child items are of the same type again

    Constructors

    TreeNode(Func<TreeNode<T>, int>, T)

    Creates a new TreeNode with the specified item as the associated Item of type T, along with an associated function for the order of all the Children items

    Declaration
    public TreeNode(Func<TreeNode<T>, int> getOrder, T item)
    Parameters
    Type Name Description
    Func<TreeNode<T>, int> getOrder

    A function specifying the order for each child item

    T item

    The associated Item of type T for this TreeNode

    TreeNode(Func<TreeNode<T>, int>, T, TreeNode<T>)

    Creates a new TreeNode with the specified item as the associated Item of type T, along with an associated function for the order of all the Children items, and the specified parent TreeNode

    Declaration
    public TreeNode(Func<TreeNode<T>, int> getOrder, T item, TreeNode<T> parent)
    Parameters
    Type Name Description
    Func<TreeNode<T>, int> getOrder

    A function specifying the order for each child item

    T item

    The associated Item of type T for this TreeNode

    TreeNode<T> parent

    The parent TreeNode<T> of this TreeNode

    TreeNode(T)

    Creates a new TreeNode with the specified item as the associated Item of type T for this TreeNode

    Declaration
    public TreeNode(T item)
    Parameters
    Type Name Description
    T item

    The associated Item of type T for this TreeNode

    TreeNode(T, TreeNode<T>)

    Creates a new TreeNode with the specified item as the associated Item of type T, along with the specified parent TreeNode

    Declaration
    public TreeNode(T item, TreeNode<T> parent)
    Parameters
    Type Name Description
    T item

    The associated Item of type T for this TreeNode

    TreeNode<T> parent

    The parent TreeNode<T> of this TreeNode

    Methods

    CreateNewItem(T, TreeNode<T>)

    Used to create a new instance of this treenode type

    Declaration
    protected override TreeNode<T> CreateNewItem(T item, TreeNode<T> parent)
    Parameters
    Type Name Description
    T item

    The item to be wrapped in a treenode

    TreeNode<T> parent

    Any parent treenode for this item

    Returns
    Type Description
    TreeNode<T>

    A new treenode with the specified item associated with it

    Overrides
    BaseTreeNode<T, TreeNode<T>>.CreateNewItem(T, TreeNode<T>)

    CreateTree(IEnumerable<T>, Func<T, T>)

    Creates a TreeNode for each item in allItems collection, returns only the top level nodes with the rest as children in the correct treenode structure

    Declaration
    public static IEnumerable<TreeNode<T>> CreateTree(IEnumerable<T> allItems, Func<T, T> getParent)
    Parameters
    Type Name Description
    IEnumerable<T> allItems

    A list of items to each be wrapped in a TreeNode<T>

    Func<T, T> getParent

    A function specifying the parent item in the allItems collection for the given item. Returns null if the item has no parent and is a root treenode item.

    Returns
    Type Description
    IEnumerable<TreeNode<T>>

    A collection of TreeNode<T> that are the root items (those with no parent as indicated by the getParent function). All other items in the allItems collection will be Children at some level of the root TreeNodes.

    Implements

    ITreeNode<T, TN>
    ITreeNode<T>
    ITreeNode
    IHasChildren<T>
    IHasChildren

    Extension Methods

    HasChildrenExtensions.GetAllChildren(IHasChildren)
    HasChildrenExtensions.GetLeafChildNodesOnly(IHasChildren)
    HasChildrenExtensions.GetRootParent(IHasChildren)
    HasChildrenExtensions.HasChildren(IHasChildren)
    HasChildrenExtensions.MaxTreeDepth(IHasChildren)
    HasChildrenExtensions.GetAllChildren<T>(IHasChildren<T>)
    HasChildrenExtensions.ContainsMatchingNode<T>(T, Func<T, bool>)
    HasChildrenExtensions.CopyNode<T>(T, HasChildrenExtensions.CreateCopiedNode<T>)
    HasChildrenExtensions.CopyNode<T>(T, T, HasChildrenExtensions.CreateCopiedNode<T>)
    HasChildrenExtensions.GetLeafChildNodesOnly<T>(T)
    HasChildrenExtensions.GetMatchingNode<T>(T, Func<T, bool>)
    HasChildrenExtensions.GetPath<T>(T, string, Func<T, string>)
    HasChildrenExtensions.GetRootParent<T>(T)
    HasChildrenExtensions.GetRootToNode<T>(T)
    LinqExtensions.AsArray<T>(T)
    LinqExtensions.ToArrayOfOne<T>(T)
    LinqExtensions.ToListOfOne<T>(T)
    MiscExtensions.SetIfNotEqual<T, TP>(T, Expression<Func<T, TP>>, TP)
    WeakReferenceExtensions.WeakReference(object)
    SQLExtensions.ToSQLValue(object, bool)
    ReflectionExtensions.ClearEventInvocations(object, string)
    StringExtensions.ToCSVFormatString(object, Type)

    See Also

    ITreeNode
    ITreeNode<T>
    ITreeNode<T, TN>
    BaseTreeNode<T, TN>
    TreeNode
    In this article
    Back to top © LemonEdge Technologies. All rights reserved.