Represents an indexed collection of key/value pairs.

See Also: IOrderedDictionary Members


public interface IOrderedDictionary : IDictionary


System.Collections.Specialized.IOrderedDictionary elements can be accessed either with the key or with the index.

Each element is a key/value pair stored in a DictionaryEntry structure.

Each pair must have a unique key that is not null, but the value can be null and does not have to be unique. The System.Collections.Specialized.IOrderedDictionary interface allows the contained keys and values to be enumerated, but it does not imply any particular sort order.

The foreach statement of the C# language (For Each in Visual Basic) requires the type of each element in the collection. Because each element of the IDictionary is a key/value pair, the element type is not the type of the key or the type of the value. Instead, the element type is DictionaryEntry, as the following example shows.

code reference: System.Collections.Specialized.IOrderedDictionary_Implementation#03

The foreach statement is a wrapper around the enumerator, which allows only reading from, not writing to, the collection.


Namespace: System.Collections.Specialized
Assembly: System (in System.dll)
Assembly Versions:,
Since: .NET 2.0