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

定义

将指定的键和值添加到 .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);
abstract member System.Collections.Generic.IDictionary<TKey,TValue>.Add : 'Key * 'Value -> unit
override this.System.Collections.Generic.IDictionary<TKey,TValue>.Add : 'Key * 'Value -> unit
Sub Add (key As TKey, value As TValue) Implements IDictionary(Of TKey, TValue).Add

参数

key
TKey

要用作要添加的元素键的对象。

value
TValue

要用作要添加的元素的值的对象。

实现

例外

keynull

中已存在具有相同键的 ConcurrentDictionary<TKey,TValue>元素。

字典包含过多的元素。

适用于

另请参阅