Class TreeNodeCollection<T>
Class representing a collection of tree nodes.
Inheritance
Inherited Members
Namespace:Extend
Assembly:Extend.dll
Syntax
public class TreeNodeCollection<T> : Collection<ITreeNode<T>>, IList<ITreeNode<T>>, IReadOnlyList<ITreeNode<T>>, IReadOnlyCollection<ITreeNode<T>>, IList, ICollection, ITreeNodeCollection<T>, ICollection<ITreeNode<T>>, IEnumerable<ITreeNode<T>>, IEnumerable
Type Parameters
Name | Description |
---|---|
T | The type of the value of the tree nodes. |
Constructors
| Improve this Doc View SourceTreeNodeCollection(ITreeNode<T>)
Initialize a new instance of the TreeNodeCollection<T> class.
Declaration
public TreeNodeCollection(ITreeNode<T> parent)
Parameters
Type | Name | Description |
---|---|---|
ITreeNode<T><T> | parent | The parent of the node. |
Properties
| Improve this Doc View SourceParent
Gets the parent of the collection.
Declaration
public ITreeNode<T> Parent { get; set; }
Property Value
Type | Description |
---|---|
ITreeNode<T><T> | The parent of the collection. |
Implements
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Parent can not be null. |
Methods
| Improve this Doc View SourceAdd(T)
Adds the given value as new node to the list and sets it's parent to the parent of the list.
Declaration
public ITreeNode<T> Add(T value)
Parameters
Type | Name | Description |
---|---|---|
T | value | The value to add. |
Returns
Type | Description |
---|---|
ITreeNode<T><T> | Returns the new created node. |
Implements
| Improve this Doc View SourceAdd(ITreeNode<T>)
Adds the given item to the list and sets it's parent to the parent of the list.
Declaration
public void Add(ITreeNode<T> item)
Parameters
Type | Name | Description |
---|---|---|
ITreeNode<T><T> | item | The item to add. |
Implements
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | item can not be null. |
Add(ITreeNode<T>, Boolean)
Adds the given item to the list and sets it's parent to the parent of the list.
Declaration
public void Add(ITreeNode<T> item, bool setParent)
Parameters
Type | Name | Description |
---|---|---|
ITreeNode<T><T> | item | The item to add. |
System.Boolean | setParent | A value indicating weather the parent of the given item should be set to the parent of the collection or not. |
Implements
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | item can not be null. |
DetachFromParent()
Detaches the collection and all it's items form it's current parent.
Declaration
public void DetachFromParent()
Implements
| Improve this Doc View SourceRemove(ITreeNode<T>)
Removes the given item form the list and sets it's parent to null.
Declaration
public bool Remove(ITreeNode<T> item)
Parameters
Type | Name | Description |
---|---|---|
ITreeNode<T><T> | item | The item to remove. |
Returns
Type | Description |
---|---|
System.Boolean | true if item is successfully removed; otherwise, false. This method also returns false if item was not found in the original System.Collections.ObjectModel.Collection<T>. |
Implements
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | item can not be null. |
Remove(ITreeNode<T>, Boolean)
Removes the given item form the list and sets it's parent to null.
Declaration
public bool Remove(ITreeNode<T> item, bool setParent)
Parameters
Type | Name | Description |
---|---|---|
ITreeNode<T><T> | item | The item to remove. |
System.Boolean | setParent | A value indicating whether the parent of the item should get set to null or not. |
Returns
Type | Description |
---|---|
System.Boolean | true if item is successfully removed; otherwise, false. This method also returns false if item was not found in the original System.Collections.ObjectModel.Collection<T>. |
Implements
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | item can not be null. |
ToString()
Returns a string that represents the current object.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | A string that represents the current object. |