LogicalTreeNodeCollection Class
Provides a base collection class for objects that implement ILogicalTreeNode.
public class LogicalTreeNodeCollection : MarshalByRefDisposableObject, IDisposable
- Inheritance:
- object MarshalByRefObject MarshalByRefDisposableObject object
- Derived:
- UIElementCollection
- Implements:
- IDisposable
Constructors
LogicalTreeNodeCollection(ILogicalTreeNode?)
Provides a base collection class for objects that implement ILogicalTreeNode.
public LogicalTreeNodeCollection(ILogicalTreeNode? owner)
| Parameter | Type | Description |
|---|---|---|
| owner | ILogicalTreeNode | The owner of the collection. |
Properties
AutoAssignParent
Indicates whether to automatically assign the parent of child objects to be the owner of the collection.
protected bool AutoAssignParent { get; set; }
Property Value
- bool:
trueif the parent of child objects should be assigned; otherwise,false.
Count
Gets the number of elements contained in the ICollection<T>.
public virtual int Count { get; }
Property Value
- int:
The number of elements contained in the ICollection<T>.
InnerList
The list of items contained in the collection instance.
IsReadOnly
Gets a value indicating whether the ICollection<T> is read-only.
public virtual bool IsReadOnly { get; }
Property Value
- bool:
trueif the ICollection<T> is read-only; otherwise,false.
OwnerCore
The ILogicalTreeNode that is the owner of the collection.
Methods
AddCore(ILogicalTreeNode)
Adds an item to the ICollection<T>.
protected int AddCore(ILogicalTreeNode value)
| Parameter | Type | Description |
|---|---|---|
| value | ILogicalTreeNode |
Returns
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | The ICollection<T> is read-only. |
ClearCore()
Removes all items from the ICollection<T>.
protected void ClearCore()
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | The ICollection<T> is read-only. |
Contains(ILogicalTreeNode)
Determines whether the ICollection<T> contains a specific value.
public virtual bool Contains(ILogicalTreeNode value)
| Parameter | Type | Description |
|---|---|---|
| value | ILogicalTreeNode |
Returns
- bool:
trueifitemis found in the ICollection<T>; otherwise,false.
CopyTo(ILogicalTreeNode[], int)
Copies the elements of the ICollection<T> to an Array, starting at a particular Array index.
public virtual void CopyTo(ILogicalTreeNode[] array, int arrayIndex)
| Parameter | Type | Description |
|---|---|---|
| array | ILogicalTreeNode[] | The one-dimensional Array that is the destination of the elements copied from ICollection<T>. The Array must have zero-based indexing. |
| arrayIndex | int | The zero-based index in |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentOutOfRangeException |
|
| ArgumentException | The number of elements in the source ICollection<T> is greater than the available space from |
Dispose(bool)
Releases the unmanaged resources used by the object and optionally releases the managed resources.
protected override void Dispose(bool disposing)
| Parameter | Type | Description |
|---|---|---|
| disposing | bool |
|
Remarks
This method is called by the public Dispose method and the Finalize method.
Dispose invokes this method with the disposing parameter set to true.
Finalize invokes this method with disposing set to false.
DisposeAllChildObjects()
Disposes each child object in the collection that implements IDisposable.
protected void DisposeAllChildObjects()
GetEnumerator()
Returns an enumerator that iterates through the collection.
public IEnumerator<ILogicalTreeNode> GetEnumerator()
Returns
- IEnumerator<ILogicalTreeNode>:
An enumerator that can be used to iterate through the collection.
IndexOf(ILogicalTreeNode)
Determines the index of a specific item in the IList<T>.
public virtual int IndexOf(ILogicalTreeNode value)
| Parameter | Type | Description |
|---|---|---|
| value | ILogicalTreeNode |
Returns
- int:
The index of
itemif found in the list; otherwise, -1.
InsertCore(int, ILogicalTreeNode)
Inserts an item to the IList<T> at the specified index.
protected void InsertCore(int index, ILogicalTreeNode value)
| Parameter | Type | Description |
|---|---|---|
| index | int | The zero-based index at which |
| value | ILogicalTreeNode | The zero-based index at which |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException |
|
| NotSupportedException | The IList<T> is read-only. |
OnObjectAdded(int, ILogicalTreeNode)
Performs additional custom processes after an object is added to the collection.
protected virtual void OnObjectAdded(int index, ILogicalTreeNode value)
| Parameter | Type | Description |
|---|---|---|
| index | int | The zero-based index at which the object was inserted. |
| value | ILogicalTreeNode | The object that was inserted. |
Remarks
The default implementation of this method is intended to be overridden by a derived class to perform some action after the specified object is added.
OnObjectAdding(int, ILogicalTreeNode)
Performs additional custom processes before an object is added to the collection.
protected virtual void OnObjectAdding(int index, ILogicalTreeNode value)
| Parameter | Type | Description |
|---|---|---|
| index | int | The zero-based index at which the object was inserted. |
| value | ILogicalTreeNode | The object that was inserted. |
Remarks
The default implementation of this method is intended to be overridden by a derived class to perform some action after the specified object is added.
OnObjectRemoved(int, ILogicalTreeNode)
Performs additional custom processes after an object is removed from the collection.
protected virtual void OnObjectRemoved(int index, ILogicalTreeNode value)
| Parameter | Type | Description |
|---|---|---|
| index | int | The zero-based index from which the object was removed. |
| value | ILogicalTreeNode | The object that was removed. |
Remarks
The default implementation of this method is intended to be overridden by a derived class to perform some action after the specified object is removed.
OnObjectRemoving(int, ILogicalTreeNode)
Performs additional custom processes before an object is removed from the collection.
protected virtual void OnObjectRemoving(int index, ILogicalTreeNode value)
| Parameter | Type | Description |
|---|---|---|
| index | int | The zero-based index from which the object was removed. |
| value | ILogicalTreeNode | The object that was removed. |
Remarks
The default implementation of this method is intended to be overridden by a derived class to perform some action before the specified object is removed.
OnValidate(ILogicalTreeNode, int)
Performs additional custom processes when validating a value.
protected virtual void OnValidate(ILogicalTreeNode value, int existingIndex)
| Parameter | Type | Description |
|---|---|---|
| value | ILogicalTreeNode | The object to validate. |
| existingIndex | int | The index within the collection of the object that would be replaced by the value. |
Remarks
The default implementation of this method determines whether value is null, and if so,
throws ArgumentNullException. It is intended to be overridden by a derived class to
perform additional action when the specified element is validated.
RemoveAtCore(int)
Removes the IList<T> item at the specified index.
protected void RemoveAtCore(int index)
| Parameter | Type | Description |
|---|---|---|
| index | int | The zero-based index of the item to remove. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException |
|
| NotSupportedException | The IList<T> is read-only. |
RemoveCore(ILogicalTreeNode)
Removes the first occurrence of a specific object from the ICollection<T>.
protected bool RemoveCore(ILogicalTreeNode value)
| Parameter | Type | Description |
|---|---|---|
| value | ILogicalTreeNode |
Returns
- bool:
trueifitemwas successfully removed from the ICollection<T>; otherwise,false. This method also returnsfalseifitemis not found in the original ICollection<T>.
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | The ICollection<T> is read-only. |
SetCore(int, ILogicalTreeNode)
Sets a value at the specified index in the collection.
protected void SetCore(int index, ILogicalTreeNode value)
| Parameter | Type | Description |
|---|---|---|
| index | int | The zero-based index of the object to set. |
| value | ILogicalTreeNode | The object to add to the collection. |
Events
ObjectAdded
Occurs after an object is added to the collection.
public event LogicalTreeNodeCollectionEventHandler? ObjectAdded
Event Type
ObjectAdding
Occurs before an object is added to the collection.
public event LogicalTreeNodeCollectionEventHandler? ObjectAdding
Event Type
ObjectRemoved
Occurs after an object is removed from the collection.
public event LogicalTreeNodeCollectionEventHandler? ObjectRemoved
Event Type
ObjectRemoving
Occurs before an object is removed from the collection.
public event LogicalTreeNodeCollectionEventHandler? ObjectRemoving
Event Type
Inherited Members
- MarshalByRefDisposableObject.Dispose()
- MarshalByRefDisposableObject.VerifyNotDisposed()
- MarshalByRefDisposableObject.IsDisposed
- MarshalByRefDisposableObject.Disposed
- MarshalByRefObject.GetLifetimeService()
- MarshalByRefObject.InitializeLifetimeService()
- MarshalByRefObject.MemberwiseClone(bool)
- object.GetType()
- object.MemberwiseClone()
- object.ToString()
- object.Equals(object)
- object.Equals(object, object)
- object.ReferenceEquals(object, object)
- object.GetHashCode()