CollectionExtensions.Remove<TKey,TValue> 方法

定義

嘗試從 dictionary 中移除具有所指定 key 的值。

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 時,則為 TValuedefault 值。

傳回

dictionary 中找到具有所指定 key 的值時,為 true;當 dictionary 找不到與所指定 key 建立關聯的值時,則為 false

例外狀況

dictionarynull

適用於