OrderedDictionary Class
Assembly: System (in system.dll)
[SerializableAttribute] public ref class OrderedDictionary : IOrderedDictionary, IDictionary, ICollection, IEnumerable, ISerializable, IDeserializationCallback
/** @attribute SerializableAttribute() */ public class OrderedDictionary implements IOrderedDictionary, IDictionary, ICollection, IEnumerable, ISerializable, IDeserializationCallback
SerializableAttribute public class OrderedDictionary implements IOrderedDictionary, IDictionary, ICollection, IEnumerable, ISerializable, IDeserializationCallback
Not applicable.
Each element is a key/value pair stored in a DictionaryEntry object. A key cannot be a null reference (Nothing in Visual Basic), but a value can be.
The elements of an OrderedDictionary are not sorted in any way. OrderedDictionary collections allow access by both index as well as key.
The foreach statement of the C# language (For Each in Visual Basic) requires the type of each element in the collection. Since each element of the OrderedDictionary collection 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. The following code shows C# and Visual Basic syntax.
The foreach statement is a wrapper around the enumerator, which only allows reading from, not writing to, the collection.
The following code example demonstrates the creation, population and modification of an OrderedDictionary collection, as well as two techniques to display the contents of the OrderedDictionary: one using the Keys and Values properties and the other creating an enumerator through the GetEnumerator method.
System.Collections.Specialized.OrderedDictionary
System.Web.Configuration.AdapterDictionary
Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.