Class KeyValueCollection<TKey, TVal>
A generic key/value collection
Inheritance
Implements
Inherited Members
Namespace: OSGeo.MapGuide.MaestroAPI.Mapping
Assembly: OSGeo.MapGuide.MaestroAPI.dll
Syntax
public abstract class KeyValueCollection<TKey, TVal> : IList<TVal>, ICollection<TVal>, IEnumerable<TVal>, IList, ICollection, IEnumerable where TVal : class
Type Parameters
Name | Description |
---|---|
TKey | The type of the key. |
TVal | The type of the value. |
Constructors
| Improve this Doc View SourceKeyValueCollection()
Initializes a new instance of the KeyValueCollection<TKey, TVal> class.
Declaration
protected KeyValueCollection()
Fields
| Improve this Doc View Source_values
The internal list of value
Declaration
protected List<TVal> _values
Field Value
Type | Description |
---|---|
System. |
_valuesByKey
The internal dictionary of values keyed by its key
Declaration
protected Dictionary<TKey, TVal> _valuesByKey
Field Value
Type | Description |
---|---|
System. |
Properties
| Improve this Doc View SourceCount
Gets the number of elements contained in the System.Collections.Generic.ICollection<T>.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
System. |
The number of elements contained in the System.Collections.Generic.ICollection<T>. |
IsReadOnly
Gets a value indicating whether the System.Collections.Generic.ICollection<T> is read-only.
Declaration
public bool IsReadOnly { get; }
Property Value
Type | Description |
---|---|
System. |
true if the System.Collections.Generic.ICollection<T> is read-only; otherwise, false. |
Item[TKey]
Gets or sets the element at the specified index.
Declaration
public TVal this[TKey key] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
TKey | key |
Property Value
Type | Description |
---|---|
TVal | The element at the specified index. |
Exceptions
Type | Condition |
---|---|
System. |
|
System. |
The property is set and the System.Collections.Generic.IList<T> is read-only. |
Item[Int32]
Gets or sets the element at the specified index.
Declaration
public virtual TVal this[int index] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System. |
index |
Property Value
Type | Description |
---|---|
TVal | The element at the specified index. |
Exceptions
Type | Condition |
---|---|
System. |
|
System. |
The property is set and the System.Collections.Generic.IList<T> is read-only. |
Methods
| Improve this Doc View SourceAdd(TVal)
Adds an item to the System.Collections.Generic.ICollection<T>.
Declaration
public virtual void Add(TVal item)
Parameters
Type | Name | Description |
---|---|---|
TVal | item | The object to add to the System.Collections.Generic.ICollection<T>. |
Exceptions
Type | Condition |
---|---|
System. |
The System.Collections.Generic.ICollection<T> is read-only. |
Clear()
Removes all items from the System.Collections.Generic.ICollection<T>.
Declaration
public virtual void Clear()
Exceptions
Type | Condition |
---|---|
System. |
The System.Collections.Generic.ICollection<T> is read-only. |
Contains(TVal)
Determines whether the System.Collections.Generic.ICollection<T> contains a specific value.
Declaration
public bool Contains(TVal item)
Parameters
Type | Name | Description |
---|---|---|
TVal | item | The object to locate in the System.Collections.Generic.ICollection<T>. |
Returns
Type | Description |
---|---|
System. |
true if |
CopyTo(TVal[], Int32)
Copies the elements of the System.Collections.Generic.ICollection<T> to an System.
Declaration
public void CopyTo(TVal[] array, int arrayIndex)
Parameters
Type | Name | Description |
---|---|---|
TVal[] | array | The one-dimensional System. |
System. |
arrayIndex | The zero-based index in |
Exceptions
Type | Condition |
---|---|
System. |
|
System. |
|
System. |
|
GetEnumerator()
Returns an enumerator that iterates through the collection.
Declaration
public IEnumerator<TVal> GetEnumerator()
Returns
Type | Description |
---|---|
System. |
A System.Collections.Generic.IEnumerator<T> that can be used to iterate through the collection. |
IndexOf(TKey)
Determines the index of a specific key in the collection
Declaration
public int IndexOf(TKey key)
Parameters
Type | Name | Description |
---|---|---|
TKey | key | The key of the object to locate in the collection |
Returns
Type | Description |
---|---|
System. |
The index of |
IndexOf(TVal)
Determines the index of a specific item in the System.Collections.Generic.IList<T>.
Declaration
public int IndexOf(TVal item)
Parameters
Type | Name | Description |
---|---|---|
TVal | item | The object to locate in the System.Collections.Generic.IList<T>. |
Returns
Type | Description |
---|---|
System. |
The index of |
Insert(Int32, TVal)
Inserts an item to the System.Collections.Generic.IList<T> at the specified index.
Declaration
public virtual void Insert(int index, TVal item)
Parameters
Type | Name | Description |
---|---|---|
System. |
index | The zero-based index at which |
TVal | item | The object to insert into the System.Collections.Generic.IList<T>. |
Exceptions
Type | Condition |
---|---|
System. |
|
System. |
The System.Collections.Generic.IList<T> is read-only. |
OnBeforeItemAdded(TVal)
Called before an item is added
Declaration
protected virtual void OnBeforeItemAdded(TVal item)
Parameters
Type | Name | Description |
---|---|---|
TVal | item | The item. |
OnBeforeItemRemove(TVal)
Called before an item is removed
Declaration
protected virtual void OnBeforeItemRemove(TVal item)
Parameters
Type | Name | Description |
---|---|---|
TVal | item | The item. |
OnCollectionChanged()
Raises the Collection
Declaration
protected virtual void OnCollectionChanged()
OnItemAdded(TVal)
Called after an item has been added
Declaration
protected abstract void OnItemAdded(TVal item)
Parameters
Type | Name | Description |
---|---|---|
TVal | item | The item. |
OnItemRemoved(TVal)
Called after an item has been removed. Note this is only called if the remove operation removed the item in question
Declaration
protected abstract void OnItemRemoved(TVal value)
Parameters
Type | Name | Description |
---|---|---|
TVal | value | The value. |
Remove(TVal)
Removes the first occurrence of a specific object from the System.Collections.Generic.ICollection<T>.
Declaration
public bool Remove(TVal item)
Parameters
Type | Name | Description |
---|---|---|
TVal | item | The object to remove from the System.Collections.Generic.ICollection<T>. |
Returns
Type | Description |
---|---|
System. |
true if |
Exceptions
Type | Condition |
---|---|
System. |
The System.Collections.Generic.ICollection<T> is read-only. |
RemoveAt(Int32)
Removes the System.Collections.Generic.IList<T> item at the specified index.
Declaration
public void RemoveAt(int index)
Parameters
Type | Name | Description |
---|---|---|
System. |
index | The zero-based index of the item to remove. |
Exceptions
Type | Condition |
---|---|
System. |
|
System. |
The System.Collections.Generic.IList<T> is read-only. |
SelectKey(TVal)
Selects the key given the value.
Declaration
protected abstract TKey SelectKey(TVal value)
Parameters
Type | Name | Description |
---|---|---|
TVal | value | The value. |
Returns
Type | Description |
---|---|
TKey |
SetNewIndex(Int32, TVal)
Sets the new index of the specified object. This object must already be present inside the collection
Declaration
public void SetNewIndex(int newIndex, TVal item)
Parameters
Type | Name | Description |
---|---|---|
System. |
newIndex | |
TVal | item |
Events
| Improve this Doc View SourceCollectionChanged
Raised when the collection has been modified
Declaration
public event EventHandler CollectionChanged
Event Type
Type | Description |
---|---|
System. |
Explicit Interface Implementations
| Improve this Doc View SourceICollection.CopyTo(Array, Int32)
Declaration
void ICollection.CopyTo(Array array, int index)
Parameters
Type | Name | Description |
---|---|---|
System. |
array | |
System. |
index |
ICollection.Count
Declaration
int ICollection.Count { get; }
Returns
Type | Description |
---|---|
System. |
ICollection.IsSynchronized
Declaration
bool ICollection.IsSynchronized { get; }
Returns
Type | Description |
---|---|
System. |
ICollection.SyncRoot
Declaration
object ICollection.SyncRoot { get; }
Returns
Type | Description |
---|---|
System. |
IEnumerable.GetEnumerator()
Returns an enumerator that iterates through a collection.
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type | Description |
---|---|
System. |
An System. |
IList.Add(Object)
Declaration
int IList.Add(object value)
Parameters
Type | Name | Description |
---|---|---|
System. |
value |
Returns
Type | Description |
---|---|
System. |
IList.Clear()
Declaration
void IList.Clear()
IList.Contains(Object)
Declaration
bool IList.Contains(object value)
Parameters
Type | Name | Description |
---|---|---|
System. |
value |
Returns
Type | Description |
---|---|
System. |
IList.IndexOf(Object)
Declaration
int IList.IndexOf(object value)
Parameters
Type | Name | Description |
---|---|---|
System. |
value |
Returns
Type | Description |
---|---|
System. |
IList.Insert(Int32, Object)
Declaration
void IList.Insert(int index, object value)
Parameters
Type | Name | Description |
---|---|---|
System. |
index | |
System. |
value |
IList.IsFixedSize
Declaration
bool IList.IsFixedSize { get; }
Returns
Type | Description |
---|---|
System. |
IList.IsReadOnly
Declaration
bool IList.IsReadOnly { get; }
Returns
Type | Description |
---|---|
System. |
IList.Item[Int32]
Declaration
object IList.this[int index] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System. |
index |
Returns
Type | Description |
---|---|
System. |
IList.Remove(Object)
Declaration
void IList.Remove(object value)
Parameters
Type | Name | Description |
---|---|---|
System. |
value |
IList.RemoveAt(Int32)
Declaration
void IList.RemoveAt(int index)
Parameters
Type | Name | Description |
---|---|---|
System. |
index |