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

定義

將指定的索引鍵和值加入字典。Adds the specified key and value to the dictionary.

 virtual void System.Collections.IDictionary.Add(System::Object ^ key, System::Object ^ value) = System::Collections::IDictionary::Add;
void IDictionary.Add (object key, object value);
Sub Add (key As Object, value As Object) Implements IDictionary.Add

參數

key
Object Object Object

要用做索引鍵的物件。The object to use as the key.

value
Object Object Object

要用做值的物件。The object to use as the value.

實作

例外狀況

key nelze přiřadit 設定的索引鍵類型的類型Dictionary<TKey,TValue>key is of a type that is not assignable to the key type of the Dictionary<TKey,TValue>.

-或--or- value nelze přiřadit 設定中的值類型的類型Dictionary<TKey,TValue>value is of a type that is not assignable to the type of values in the Dictionary<TKey,TValue>.

-或--or- 具有相同索引鍵的值已經存在於Dictionary<TKey,TValue>A value with the same key already exists in the Dictionary<TKey,TValue>.

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

適用於

另請參閱