語言

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時,為 default 的 TValue值。

傳回

true 當在 中找到 dictionary 一個值,且 指定為 key; false 當 找不到 dictionary 與指定 key值 相關聯的值時 。

例外狀況

dictionary 是 null。

適用於