Remove Method

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

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

'Declaration
Public Function Remove ( _
	key As TKey _
) As Boolean

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(Of TKey, TValue).

Implements

IDictionary(Of TKey, TValue).Remove(TKey)

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

Windows Phone OS

Supported in: 8.1, 8.0

Show:
© 2017 Microsoft