Hashtable.Add Method |
System.Collections.Hashtable
hashtablevariable .Add( Key , Value )
The hash table entry's key
The hash table entry's value
None
Adds a key/value pair to the hash table
Key must be unique or a runtime error occurs.
Keys are immutable. Once added, a particular key value cannot be changed during the lifetime of the hash table except by removing it through the Remove or Clear method and then adding it once again.
Value need not be unique.
According to the documentation, it is better to build a key from a String object than the Base Class Library's StringBuilder object.
The Item property can also be used to add new members to the hash table.
To ensure that key is unique when calling the Add method, you can call the ContainsKey method beforehand.
Hashtable.ContainsKey Method, Hashtable.Item Property