Represents an indexed collection of key/value pairs.
Assembly: System (in System.dll)
Gets or sets the element at the specified index.
Gets or sets the element with the specified key.(Inherited from IDictionary.)
Returns an enumerator that iterates through thecollection.
|Insert(Int32, Object, Object)|
Inserts a key/value pair into the collection at the specified index.
Removes the element at the specified index.
Overloaded. Enables parallelization of a query.(Defined by ParallelEnumerable.)
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. Theinterface 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.
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 ArrayList class. The implemented stores first names as the keys and last names as the values, with the added requirement that each first name is unique.based on the
Available since 10
Available since 2.0