Muokkaa

Jaa


CollectionExtensions.Remove<TKey,TValue> Method

Definition

Tries to remove the value with the specified key from the dictionary.

public:
generic <typename TKey, typename TValue>
[System::Runtime::CompilerServices::Extension]
 static bool Remove(System::Collections::Generic::IDictionary<TKey, TValue> ^ dictionary, TKey key, [Runtime::InteropServices::Out] TValue % value);
public static bool Remove<TKey,TValue> (this System.Collections.Generic.IDictionary<TKey,TValue> dictionary, TKey key, out TValue value);
static member Remove : System.Collections.Generic.IDictionary<'Key, 'Value> * 'Key * 'Value -> bool
<Extension()>
Public Function Remove(Of TKey, TValue) (dictionary As IDictionary(Of TKey, TValue), key As TKey, ByRef value As TValue) As Boolean

Type Parameters

TKey

The type of the keys in the dictionary.

TValue

The type of the values in the dictionary.

Parameters

dictionary
IDictionary<TKey,TValue>

A dictionary with keys of type TKey and values of type TValue.

key
TKey

The key of the value to remove.

value
TValue

When this method returns true, the removed value; when this method returns false, the default value for TValue.

Returns

true when a value is found in the dictionary with the specified key; false when the dictionary cannot find a value associated with the specified key.

Exceptions

dictionary is null.

Applies to