Dictionary<TKey,TValue>.ICollection<KeyValuePair<TKey,TValue>>.Add 方法

定义

添加指定值到带有指定键的 ICollection<T>

 virtual void System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey,TValue>>.Add(System::Collections::Generic::KeyValuePair<TKey, TValue> keyValuePair) = System::Collections::Generic::ICollection<System::Collections::Generic::KeyValuePair<TKey, TValue>>::Add;
void ICollection<KeyValuePair<TKey,TValue>>.Add (System.Collections.Generic.KeyValuePair<TKey,TValue> keyValuePair);
abstract member System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey,TValue>>.Add : System.Collections.Generic.KeyValuePair<'Key, 'Value> -> unit
override this.System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey,TValue>>.Add : System.Collections.Generic.KeyValuePair<'Key, 'Value> -> unit
Sub Add (keyValuePair As KeyValuePair(Of TKey, TValue)) Implements ICollection(Of KeyValuePair(Of TKey, TValue)).Add

参数

keyValuePair
KeyValuePair<TKey,TValue>

表示要添加到 Dictionary<TKey,TValue> 中的键和值的 KeyValuePair<TKey,TValue> 结构。

实现

例外

keyValuePair 的键为 null

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

适用于