ConcurrentDictionary<TKey,TValue>.IDictionary<TKey,TValue>.Add(TKey, TValue) ConcurrentDictionary<TKey,TValue>.IDictionary<TKey,TValue>.Add(TKey, TValue) ConcurrentDictionary<TKey,TValue>.IDictionary<TKey,TValue>.Add(TKey, TValue) Method

定義

將指定的索引鍵和值加入 IDictionary<TKey,TValue>Adds the specified key and value to the IDictionary<TKey,TValue>.

 virtual void System.Collections.Generic.IDictionary<TKey,TValue>.Add(TKey key, TValue value) = System::Collections::Generic::IDictionary<TKey, TValue>::Add;
void IDictionary<TKey,TValue>.Add (TKey key, TValue value);
Sub Add (key As TKey, value As TValue) Implements IDictionary(Of TKey, TValue).Add

參數

key
TKey TKey TKey

做為要加入項目之索引鍵的物件。The object to use as the key of the element to add.

value
TValue TValue TValue

做為要加入項目之值的物件。The object to use as the value of the element to add.

實作

例外狀況

ConcurrentDictionary<TKey,TValue> 中已存在具有相同索引鍵的元素。An element with the same key already exists in the ConcurrentDictionary<TKey,TValue>.

字典已經包含項目數目上限 (MaxValue)。The dictionary already contains the maximum number of elements (MaxValue).

適用於

另請參閱