ConcurrentDictionary<TKey,TValue>.IDictionary.Add 方法

定义

将指定的键和值添加到字典。

 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

要用作值的对象。

实现

例外

keynull

key 是一种类型,不能分配给该 Dictionary<TKey,TValue>类型的键类型。

-或-

value 是一种类型,不能分配给值的类型 Dictionary<TKey,TValue>

-或-

中已存在 Dictionary<TKey,TValue>具有相同键的值。

字典包含过多的元素。

适用于

另请参阅