ConcurrentDictionary<TKey,TValue>.IDictionary<TKey,TValue>.Add(TKey, TValue) 方法
定义
向 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);
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
用作要添加的元素的键的对象。The object to use as the key of the element to add.
- value
- TValue
用作要添加的元素的值的对象。The object to use as the value of the element to add.
实现
例外
key 为 null。key is null.
ConcurrentDictionary<TKey,TValue> 中已存在具有相同键的元素。An element with the same key already exists in the ConcurrentDictionary<TKey,TValue>.
字典包含过多元素。The dictionary contains too many elements.