In This Article

KeyedLogicalTreeNodeCollection Class

Provides a base collection class for objects that implement IKeyedLogicalTreeNode.

public class KeyedLogicalTreeNodeCollection : LogicalTreeNodeCollection, IDisposable
Inheritance:
object MarshalByRefObject DisposableObject LogicalTreeNodeCollection object
Implements:
IDisposable

Constructors

KeyedLogicalTreeNodeCollection(ILogicalTreeNode)

Initializes a new instance of the KeyedLogicalTreeNodeCollection class.

public KeyedLogicalTreeNodeCollection(ILogicalTreeNode owner)
Parameter Type Description
owner ILogicalTreeNode

The owner of the collection.

Properties

AllowDuplicateKeys

Gets whether duplicate keys are permitted within the collection.

public virtual bool AllowDuplicateKeys { get; }

Property Value

bool:

true if duplicate keys are permitted; otherwise, false.

AllowEmptyKeys

Gets whether empty keys are permitted within the collection.

public virtual bool AllowEmptyKeys { get; }

Property Value

bool:

true if empty keys are permitted; otherwise, false.

Methods

Contains(string)

Determines whether a key is in the collection.

public virtual bool Contains(string key)
Parameter Type Description
key string

The key to locate in the collection.

Returns

bool:

true if the key is found in the collection; otherwise, false.

IndexOf(string)

Searches for the specified key and returns the zero-based index of the first occurrence within the entire collection.

public virtual int IndexOf(string key)
Parameter Type Description
key string

The key to locate in the collection.

Returns

int:

The zero-based index of the first occurrence of the key within the entire collection, if found; otherwise, -1.

OnValidate(ILogicalTreeNode, int)

Performs additional custom processes when validating a value.

protected override 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 also implements rules defined by AllowEmptyKeys and AllowDuplicateKeys. It is intended to be overridden by a derived class to perform additional action when the specified element is validated.

Inherited Members