using System; using System.Collections.Generic; using System.Collections.Specialized; // From http://www.codeproject.com/KB/recipes/GenericOrderedDictionary.aspx namespace NW4RTools.Util { /// /// Represents a generic collection of key/value pairs that are ordered independently of the key and value. /// /// The type of the keys in the dictionary /// The type of the values in the dictionary public interface IOrderedDictionary : IOrderedDictionary, IDictionary { /// /// Adds an entry with the specified key and value into the IOrderedDictionary<TKey,TValue> collection with the lowest available index. /// /// The key of the entry to add. /// The value of the entry to add. /// The index of the newly added entry /// /// You can also use the property to add new elements by setting the value of a key that does not exist in the IOrderedDictionary<TKey,TValue> collection; however, if the specified key already exists in the IOrderedDictionary<TKey,TValue>, setting the property overwrites the old value. In contrast, the method does not modify existing elements. /// An element with the same key already exists in the IOrderedDictionary<TKey,TValue> /// The IOrderedDictionary<TKey,TValue> is read-only.
/// -or-
/// The IOrderedDictionary<TKey,TValue> has a fized size.
new int Add(TKey key, TValue value); /// /// Inserts a new entry into the IOrderedDictionary<TKey,TValue> collection with the specified key and value at the specified index. /// /// The zero-based index at which the element should be inserted. /// The key of the entry to add. /// The value of the entry to add. The value can be if the type of the values in the dictionary is a reference type. /// is less than 0.
/// -or-
/// is greater than .
/// An element with the same key already exists in the IOrderedDictionary<TKey,TValue>. /// The IOrderedDictionary<TKey,TValue> is read-only.
/// -or-
/// The IOrderedDictionary<TKey,TValue> has a fized size.
void Insert(int index, TKey key, TValue value); /// /// Gets or sets the value at the specified index. /// /// The zero-based index of the value to get or set. /// The value of the item at the specified index. /// is less than 0.
/// -or-
/// is equal to or greater than .
new TValue this[int index] { get; set; } TKey GetKeyForIndex(int index); TKey GetKeyForValue(TValue value); int GetIndexForValue(TValue value); } }