IOrderedDictionary Interface

 

Represents an indexed collection of key/value pairs.

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

type IOrderedDictionary = 
    interface
        interface IDictionary
        interface ICollection
        interface IEnumerable
    end

NameDescription
System_CAPS_pubpropertyCount

Gets the number of elements contained in the ICollection.(Inherited from ICollection.)

System_CAPS_pubpropertyIsFixedSize

Gets a value indicating whether the IDictionary object has a fixed size.(Inherited from IDictionary.)

System_CAPS_pubpropertyIsReadOnly

Gets a value indicating whether the IDictionary object is read-only.(Inherited from IDictionary.)

System_CAPS_pubpropertyIsSynchronized

Gets a value indicating whether access to the ICollection is synchronized (thread safe).(Inherited from ICollection.)

System_CAPS_pubpropertyItem(Int32)

Gets or sets the element at the specified index.

System_CAPS_pubpropertyItem(Object)

Gets or sets the element with the specified key.(Inherited from IDictionary.)

System_CAPS_pubpropertyKeys

Gets an ICollection object containing the keys of the IDictionary object.(Inherited from IDictionary.)

System_CAPS_pubpropertySyncRoot

Gets an object that can be used to synchronize access to the ICollection.(Inherited from ICollection.)

System_CAPS_pubpropertyValues

Gets an ICollection object containing the values in the IDictionary object.(Inherited from IDictionary.)

NameDescription
System_CAPS_pubmethodAdd(Object, Object)

Adds an element with the provided key and value to the IDictionary object.(Inherited from IDictionary.)

System_CAPS_pubmethodClear()

Removes all elements from the IDictionary object.(Inherited from IDictionary.)

System_CAPS_pubmethodContains(Object)

Determines whether the IDictionary object contains an element with the specified key.(Inherited from IDictionary.)

System_CAPS_pubmethodCopyTo(Array, Int32)

Copies the elements of the ICollection to an Array, starting at a particular Array index.(Inherited from ICollection.)

System_CAPS_pubmethodGetEnumerator()

Returns an enumerator that iterates through the IOrderedDictionary collection.

System_CAPS_pubmethodInsert(Int32, Object, Object)

Inserts a key/value pair into the collection at the specified index.

System_CAPS_pubmethodRemove(Object)

Removes the element with the specified key from the IDictionary object.(Inherited from IDictionary.)

System_CAPS_pubmethodRemoveAt(Int32)

Removes the element at the specified index.

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.)

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 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) returns an object of the type of the elements 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.

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

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

Notes to Implementers:

The implementing class must have a means to compare keys.

The following code example demonstrates the implementation of a simple IOrderedDictionary based on the ArrayList class. The implemented IOrderedDictionary stores first names as the keys and last names as the values, with the added requirement that each first name is unique.

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
Return to top
Show: