The hash table consists of items that are in key pairs. These keys that are there in pairs are also used in the form of indexes and search via these keys can generate quick results. The Add () method is used to insert items in Hashtable. Hashtables are basically the data structure that can associate with the keys with values. If a particular key is provided, one can find out the corresponding value to it with the aid of Hashtable.
Example: Showing the creation of a new Hashtable
private Hashtable MyTable = new Hashtable(); MyTable.Add(Person1.Lname, Person1); MyTable.Add(Person2.Lname, Person2); MyTable.Add(Person3.Lname, Person3);
|