Set> hash table class Hashtable
Hashtable is a set of key-value pairs. The hash table is unordered and does not provide a sorting method.
Set> hash table class Hashtable> construct a normal hash table
Code Using System;
Using System. Collections. Generic;
Using System. Text;
Using System. Collections;
Namespace ConsoleApplication1
{
Class Program
{
Static void Main (string [] args)
{
// Use all default values to create a hash table instance
Hashtable ht = new Hashtable ();
// Specify the initial capacity of the hash table instance as 20 elements.
Hashtable ht1 = new Hashtable (20 );
// A hash table instance with an initial capacity of 20 elements and a loading Factor of 0.8 has a large loading factor, and the automatic expansion capacity of the hash table is also large.
Hashtable ht2 = new Hashtable (20, 0.8f );
// Instantiate a SortedList.
SortedList sl = new SortedList ();
Sl. Add ("Key 1", "key value 1 ");
Sl. Add ("Key 2", "Key 2 ");
Sl. Add ("key 3", "key 3 ");
// Input parameters that implement the IDictionary interface to create a hash table.
Hashtable ht3 = new Hashtable (sl );
}
}
}
Set> hash table class Hashtable> Get hash table Value
Code Using System;
Using System. Collections. Generic;
Using System. Text;
Using System. Collections;
Namespace useHashtable
{
Class Program
{
Static void Main (