SortedDictionary<'TKey, 'TValue>.Remove Method ('TKey)
.NET Framework (current version)
Removes the element with the specified key from the SortedDictionary<'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<'TKey, 'TValue>.
| Exception | Condition |
|---|---|
| ArgumentNullException | key is null. |
If the SortedDictionary<'TKey, 'TValue> does not contain an element with the specified key, the SortedDictionary<'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<'TKey, 'TValue> class.
Universal Windows Platform
Available since 8
.NET Framework
Available since 2.0
Portable Class Library
Supported in: portable .NET platforms
Windows Phone Silverlight
Available since 8.0
Windows Phone
Available since 8.1
Available since 8
.NET Framework
Available since 2.0
Portable Class Library
Supported in: portable .NET platforms
Windows Phone Silverlight
Available since 8.0
Windows Phone
Available since 8.1
Show: