Mono Class Library: System.Collections.IDictionary Overview | Members

System.Collections.IDictionary.Add Method

Adds an entry with the provided key and value to the current instance.

public void Add (object key, object value)

Parameters

key
The object to use as the key of the entry to add.
value
The object to use as the value of the entry to add.

Exceptions

TypeReason
ArgumentNullExceptionkey is null.
ArgumentException An entry with the same key already exists in the current instance.
NotSupportedExceptionThe current instance is read-only or has a fixed size.

Remarks

If the specified key already exists in the current instance, this method throws a ArgumentException exception but does not modify the associated value.

Operation
As described above.

Requirements

Namespace: System.Collections
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0