OrderedDictionary Class

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Represents a collection of key/value pairs that are accessible by the key or index.

Namespace:   System.Collections.Specialized
Assembly:  System (in System.dll)

System.Object
  System.Collections.Specialized.OrderedDictionary
    System.Web.Configuration.AdapterDictionary

[<SerializableAttribute>]
type OrderedDictionary = 
    class
        interface IOrderedDictionary
        interface IDictionary
        interface ICollection
        interface IEnumerable
        interface ISerializable
        interface IDeserializationCallback
    end

NameDescription
System_CAPS_pubmethodOrderedDictionary()

Initializes a new instance of the OrderedDictionary class.

System_CAPS_pubmethodOrderedDictionary(IEqualityComparer)

Initializes a new instance of the OrderedDictionary class using the specified comparer.

System_CAPS_pubmethodOrderedDictionary(Int32)

Initializes a new instance of the OrderedDictionary class using the specified initial capacity.

System_CAPS_pubmethodOrderedDictionary(Int32, IEqualityComparer)

Initializes a new instance of the OrderedDictionary class using the specified initial capacity and comparer.

System_CAPS_protmethodOrderedDictionary(SerializationInfo, StreamingContext)

Initializes a new instance of the OrderedDictionary class that is serializable using the specified SerializationInfo and StreamingContext objects.

NameDescription
System_CAPS_pubpropertyCount

Gets the number of key/values pairs contained in the OrderedDictionary collection.

System_CAPS_pubpropertyIsReadOnly

Gets a value indicating whether the OrderedDictionary collection is read-only.

System_CAPS_pubpropertyItem(Int32)

Gets or sets the value at the specified index.

System_CAPS_pubpropertyItem(Object)

Gets or sets the value with the specified key.

System_CAPS_pubpropertyKeys

Gets an ICollection object containing the keys in the OrderedDictionary collection.

System_CAPS_pubpropertyValues

Gets an ICollection object containing the values in the OrderedDictionary collection.

NameDescription
System_CAPS_pubmethodAdd(Object, Object)

Adds an entry with the specified key and value into the OrderedDictionary collection with the lowest available index.

System_CAPS_pubmethodAsReadOnly()

Returns a read-only copy of the current OrderedDictionary collection.

System_CAPS_pubmethodClear()

Removes all elements from the OrderedDictionary collection.

System_CAPS_pubmethodContains(Object)

Determines whether the OrderedDictionary collection contains a specific key.

System_CAPS_pubmethodCopyTo(Array, Int32)

Copies the OrderedDictionary elements to a one-dimensional Array object at the specified index.

System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethodGetEnumerator()

Returns an IDictionaryEnumerator object that iterates through the OrderedDictionary collection.

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetObjectData(SerializationInfo, StreamingContext)

Implements the ISerializable interface and returns the data needed to serialize the OrderedDictionary collection.

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodInsert(Int32, Object, Object)

Inserts a new entry into the OrderedDictionary collection with the specified key and value at the specified index.

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_protmethodOnDeserialization(Object)

Implements the ISerializable interface and is called back by the deserialization event when deserialization is complete.

System_CAPS_pubmethodRemove(Object)

Removes the entry with the specified key from the OrderedDictionary collection.

System_CAPS_pubmethodRemoveAt(Int32)

Removes the entry at the specified index from the OrderedDictionary collection.

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

NameDescription
System_CAPS_pubinterfaceSystem_CAPS_privmethodIEnumerable.GetEnumerator()

This API supports the product infrastructure and is not intended to be used directly from your code. Returns an IDictionaryEnumerator object that iterates through the OrderedDictionary collection.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIDeserializationCallback.OnDeserialization(Object)

Implements the ISerializable interface and is called back by the deserialization event when deserialization is complete.

System_CAPS_pubinterfaceSystem_CAPS_privpropertyICollection.IsSynchronized

Gets a value indicating whether access to the OrderedDictionary object is synchronized (thread-safe).

System_CAPS_pubinterfaceSystem_CAPS_privpropertyICollection.SyncRoot

Gets an object that can be used to synchronize access to the OrderedDictionary object.

System_CAPS_pubinterfaceSystem_CAPS_privpropertyIDictionary.IsFixedSize

Gets a value indicating whether the OrderedDictionary has a fixed size.

NameDescription
System_CAPS_pubmethodAsParallel()

Overloaded. Enables parallelization of a query.(Defined by ParallelEnumerable.)

System_CAPS_pubmethodAsQueryable()

Overloaded. Converts an IEnumerable to an IQueryable.(Defined by Queryable.)

System_CAPS_pubmethodCast<'TResult>()

Casts the elements of an IEnumerable to the specified type.(Defined by Enumerable.)

System_CAPS_pubmethodOfType<'TResult>()

Filters the elements of an IEnumerable based on a specified type.(Defined by Enumerable.)

Each element is a key/value pair stored in a DictionaryEntry object. A key cannot be null, but a value can be.

The elements of an OrderedDictionary are not sorted by the key, unlike the elements of a SortedDictionary<'TKey, 'TValue> class. You can access elements either by the key or by the index.

The foreach statement of the C# language (For Each in Visual Basic) returns objects that are of 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#, Visual Basic and C++ syntax.

No code example is currently available or this language may not be supported.

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.

No code example is currently available or this language may not be supported.

Universal Windows Platform
Available since 10
.NET Framework
Available since 2.0

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: