Condividi tramite


DictionaryExtensions.TryRemove<TKey,TValue> Method

Definition

Removes the value associated with specified key.

public static bool TryRemove<TKey,TValue> (this System.Collections.Generic.Dictionary<TKey,TValue> dictionary, TKey key, out TValue value);
static member TryRemove : System.Collections.Generic.Dictionary<'Key, 'Value> * 'Key * 'Value -> bool
<Extension()>
Public Function TryRemove(Of TKey, TValue) (dictionary As Dictionary(Of TKey, TValue), key As TKey, ByRef value As TValue) As Boolean

Type Parameters

TKey

The type of the key parameter.

TValue

The type of the value parameter.

Parameters

dictionary
Dictionary<TKey,TValue>

The dictionary containing the specified key.

key
TKey

The key whose value to get.

value
TValue

The value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter.

Returns

True if the dictionary contains an element with the specified key; otherwise, false.

Applies to