Click or drag to resize
HashtableAdd Method
Adds an element with the specified key and value into the Hashtable.

Namespace: System.Collections
Assembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax
C#
public virtual void Add(
	Object key,
	Object value
)

Parameters

key
Type: SystemObject
The key of the element to add.
value
Type: SystemObject
The value of the element to add. The value can be null.
Exceptions
ExceptionCondition
ArgumentNullExceptionkey is null.
ArgumentExceptionAn element with the same key already exists in the Hashtable.
NotSupportedExceptionThe Hashtable is read-only.-or- The Hashtable has a fixed size.
See Also