Dictionary<TKey,TValue>.ICollection<KeyValuePair<TKey,TValue>>.Add(KeyValuePair<TKey,TValue>) Dictionary<TKey,TValue>.ICollection<KeyValuePair<TKey,TValue>>.Add(KeyValuePair<TKey,TValue>) Dictionary<TKey,TValue>.ICollection<KeyValuePair<TKey,TValue>>.Add(KeyValuePair<TKey,TValue>) Method

定義

將指定的值加入具有指定索引鍵的 ICollection<T>Adds the specified value to the ICollection<T> with the specified key.

 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);
Sub Add (keyValuePair As KeyValuePair(Of TKey, TValue)) Implements ICollection(Of KeyValuePair(Of TKey, TValue)).Add

參數

keyValuePair
KeyValuePair<TKey,TValue> KeyValuePair<TKey,TValue> KeyValuePair<TKey,TValue>

KeyValuePair<TKey,TValue> 結構,代表要加入 Dictionary<TKey,TValue> 的索引鍵和值。The KeyValuePair<TKey,TValue> structure representing the key and value to add to the Dictionary<TKey,TValue>.

實作

例外狀況

keyValuePair 的索引鍵是 nullThe key of keyValuePair is null.

Dictionary<TKey,TValue> 中已存在具有相同索引鍵的元素。An element with the same key already exists in the Dictionary<TKey,TValue>.

適用於