CollectionExtensions.Remove<TKey,TValue> 方法

定义

尝试从中删除具有指定keydictionary值的值。

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

类型参数

TKey

中键 dictionary的类型。

TValue

dictionary值的类型。

参数

dictionary
IDictionary<TKey,TValue>

包含类型 TKey 键和类型的 TValue值的字典。

key
TKey

要删除的值的键。

value
TValue

此方法返回true时,已删除的值;此方法返回false时,返回defaultTValue的值。

返回

true当在指定值中找到dictionary时;key当找不到与指定false值关联的值时dictionarykey

例外

dictionarynull

适用于