SortedDictionary<'TKey, 'TValue>.Remove Method ('TKey)

 

Removes the element with the specified key from the SortedDictionary<'TKey, 'TValue>.

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

abstract Remove : 
        key:'TKey -> bool
override Remove : 
        key:'TKey -> bool

Parameters

key
Type: TKey

The key of the element to remove.

Return Value

Type: System.Boolean

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

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

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