ConcurrentDictionary<TKey,TValue>.IDictionary.Add 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
將指定的索引鍵和值加入至字典。
virtual void System.Collections.IDictionary.Add(System::Object ^ key, System::Object ^ value) = System::Collections::IDictionary::Add;
void IDictionary.Add(object key, object value);
abstract member System.Collections.IDictionary.Add : obj * obj -> unit
override this.System.Collections.IDictionary.Add : obj * obj -> unit
Sub Add (key As Object, value As Object) Implements IDictionary.Add
參數
- key
- Object
作為鑰匙的物件。
- value
- Object
要用來當值的物件。
實作
例外狀況
key 是 null。
key 屬於一種無法指派到鍵 Dictionary<TKey,TValue>型別的類型。
-或-
value 屬於無法指派於 中 Dictionary<TKey,TValue>值類型的類型。
-或-
在 中 Dictionary<TKey,TValue>已經存在具有相同鍵的值。
字典包含太多元素。