共用方式為


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

定義

將項目新增至集合。

 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>

要加入至字典的 KeyValuePair<TKey,TValue>

實作

例外狀況

keyValuePairKeynull

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

適用於

另請參閱