SortedDictionary(Of TKey, TValue).Remove Method
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Removes the element with the specified key from the SortedDictionary(Of TKey, TValue).
Assembly: System (in System.dll)
Parameters
- key
- Type: TKey
The key of the element to remove.
Return Value
Type: System.Booleantrue if the element is successfully removed; otherwise, false. This method also returns false if key is not found in the SortedDictionary(Of TKey, TValue).
Implements
IDictionary(Of TKey, TValue).Remove(TKey)| Exception | Condition |
|---|---|
| ArgumentNullException | key is Nothing. |
If the SortedDictionary(Of TKey, TValue) does not contain an element with the specified key, the SortedDictionary(Of TKey, TValue) remains unchanged. No exception is thrown.
This method is an O(log n) operation.
The following code example shows how to remove a key/value pair from the dictionary using the Remove method.
This code example is part of a larger example provided for the SortedDictionary(Of TKey, TValue) class.