語言

ReadOnlyDictionary<TKey,TValue>.IDictionary.Add(Object, Object) 方法

定義

在所有情況下都會投 NotSupportedException 出例外。

 virtual void System.Collections.IDictionary.Add(System::Object ^ key, System::Object ^ value) = System::Collections::IDictionary::Add;
void IDictionary.Add(object key, object value);
abstract member System.Collections.IDictionary.Add : obj * obj -> unit
override this.System.Collections.IDictionary.Add : obj * obj -> unit
Sub Add (key As Object, value As Object) Implements IDictionary.Add

參數

key
Object

元素的關鍵是要添加的。

value
Object

要加入元素的價值。

實作

例外狀況

無論哪種情況。

備註

此成員為明確介面成員實作。 它只能在實 ReadOnlyDictionary<TKey,TValue> 例投射到 IDictionary 介面時使用。 介面IDictionary規定Add,若實作該介面的集合是唯讀,方法應拋出NotSupportedException例外。

適用於