OrderedDictionary.Remove Method (Object)
Removes the entry with the specified key from the OrderedDictionary collection.
Assembly: System (in System.dll)
Parameters
- key
-
Type:
System.Object
The key of the entry to remove.
Implements
IDictionary.Remove(Object)| Exception | Condition |
|---|---|
| NotSupportedException | The OrderedDictionary collection is read-only. |
| ArgumentNullException | key is null. |
The entries that follow the removed entry move up to occupy the vacated spot and the indexes of the entries that move are also updated.
If the OrderedDictionary collection does not contain an entry with the specified key, the OrderedDictionary remains unchanged and no exception is thrown.
The following code example demonstrates the modification of an OrderedDictionary collection. In this example, the Remove method is used to remove the entry with the key "keyToDelete" from the OrderedDictionary. This code is part of a larger code example that can be viewed at OrderedDictionary.
Available since 10
.NET Framework
Available since 2.0