SortedList.System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey,TValue>>.Remove Method 

Note: This method is new in the .NET Framework version 2.0.

Removes the first occurrence of a specific key/value pair from the ICollection.

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

Syntax

'Declaration
Private Function System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey,TValue>>.Remove ( _
    keyValuePair As KeyValuePair(Of TKey, TValue) _
) As Boolean Implements ICollection(Of KeyValuePair(Of TKey, TValue)).Remove
'Usage
Dim instance As SortedList(Of TKey, TValue)
Dim keyValuePair As KeyValuePair(Of TKey, TValue)
Dim returnValue As Boolean

returnValue = CType(instance, ICollection(Of KeyValuePair(Of TKey, TValue))).Remove(keyValuePair)
bool ICollection<KeyValuePair<TKey,TValue>>.Remove (
    KeyValuePair<TKey,TValue> keyValuePair
)
private:
virtual bool System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey,TValue>>.Remove (
    KeyValuePair<TKey, TValue> keyValuePair
) sealed = ICollection<KeyValuePair<TKey, TValue>>::Remove
J# supports the use of explicit interface implementations, but not the declaration of new ones.
JScript supports the use of explicit interface implementations, but not the declarations of new ones.

Parameters

Return Value

true if keyValuePair was successfully removed from the ICollection; otherwise, false. This method also returns false if keyValuePair was not found in the original ICollection.

Remarks

This method determines equality using the default comparer Comparer.Default for System.Collections.Generic.KeyValuePair.

This method performs a binary search; however, the elements are moved up to fill in the open spot, so this method is an O(n) operation, where n is Count.

Platforms

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

Version Information

.NET Framework

Supported in: 2.0

.NET Compact Framework

Supported in: 2.0

See Also

Reference

SortedList Generic Class
SortedList Members
System.Collections.Generic Namespace
SortedList.Remove Method
SortedList.RemoveAt Method