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
    System.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>>.Item
    BaseTreeNode<T, TreeNode<T>>.CreateNewItem(T, TreeNode<T>)
    BaseTreeNode<T, TreeNode<T>>.AddChild(T)
    BaseTreeNode<T, TreeNode<T>>.ITreeNode.Item
    BaseHasChildren<TreeNode<T>>.Order
    BaseHasChildren<TreeNode<T>>.Children
    BaseHasChildren<TreeNode<T>>.AddChild(TreeNode<T>)
    BaseHasChildren<TreeNode<T>>.DeleteChild(TreeNode<T>)
    BaseHasChildren<TreeNode<T>>.ClearChildren()
    BaseHasChildren<TreeNode<T>>.Parent
    BaseHasChildren<TreeNode<T>>.AddChild(IHasChildren)
    BaseHasChildren<TreeNode<T>>.DeleteChild(IHasChildren)
    BaseHasChildren<TreeNode<T>>.IHasChildren.Children
    BaseHasChildren<TreeNode<T>>.IHasChildren.Parent
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: LemonEdge.Utils
    Assembly: 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(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

    TreeNode(Func<TreeNode<T>, Int32>, 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
    System.Func<TreeNode<T>, System.Int32> 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>, Int32>, 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
    System.Func<TreeNode<T>, System.Int32> 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

    Methods

    CreateNewItem(T, TreeNode<T>)

    Declaration
    protected override TreeNode<T> CreateNewItem(T item, TreeNode<T> parent)
    Parameters
    Type Name Description
    T item
    TreeNode<T> parent
    Returns
    Type Description
    TreeNode<T>
    Overrides
    LemonEdge.Utils.BaseTreeNode<T, LemonEdge.Utils.TreeNode<T>>.CreateNewItem(T, LemonEdge.Utils.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
    System.Collections.Generic.IEnumerable<T> allItems

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

    System.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
    System.Collections.Generic.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.HasChildren(IHasChildren)
    HasChildrenExtensions.GetAllChildren(IHasChildren)
    HasChildrenExtensions.GetRootParent(IHasChildren)
    HasChildrenExtensions.GetLeafChildNodesOnly(IHasChildren)
    HasChildrenExtensions.GetAllChildren<T>(IHasChildren<T>)
    HasChildrenExtensions.GetRootParent<T>(T)
    HasChildrenExtensions.GetLeafChildNodesOnly<T>(T)
    HasChildrenExtensions.ContainsMatchingNode<T>(T, Func<T, Boolean>)
    HasChildrenExtensions.GetMatchingNode<T>(T, Func<T, Boolean>)
    HasChildrenExtensions.MaxTreeDepth(IHasChildren)
    HasChildrenExtensions.GetRootToNode<T>(T)
    HasChildrenExtensions.GetPath<T>(T, String, Func<T, String>)
    MiscExtensions.SetIfNotEqual<T, P>(T, Expression<Func<T, P>>, P)
    ReflectionExtensions.ClearEventInvocations(Object, String)
    StringExtensions.ToCSVFormatString(Object, Type)
    SQLExtensions.ToSQLValue(Object, Boolean)

    See Also

    ITreeNode
    ITreeNode<T>
    ITreeNode<T, TN>
    BaseTreeNode<T, TN>
    TreeNode
    In This Article
    Back to top © LemonTree Software Ltd. All rights reserved.