Hi gudarzi,
Please find below the explanation of hashtable with example
HASHTABLE -Represents a collection of key/value pairs that are organized based on the hash code of the key.
-This optimizes lookups. It computes a hash of each key you add. It then uses this hash code to look up the element very quickly. Example
We create a Hashtable with a constructor. When it is created, the Hashtable has no values. We directly assign values with the indexer, which uses the square brackets.
Next:The example adds three integer keys, with one string value each, to the Hashtable object.
Result:The program displays all the DictionaryEntry objects returned from the enumerator in the foreach-loop.
WriteLine:The WriteLine call contains a format string that displays the key-value pairs with a comma.
C#
using System;
using System.Collections;
class Program
{
static void Main()
{
Hashtable hashtable = new Hashtable();
hashtable[1] = "One";
hashtable[2] = "Two";
hashtable[13] = "Thirteen";
foreach (DictionaryEntry entry in hashtable)
{
Console.WriteLine("{0}, {1}", entry.Key, entry.Value);
}
}
}
OUTPUT
13, Thirteen
2, Two
1, One
and if you want to know in more detail then you can follow link
https://msdn.microsoft.com/en-us/library/system.collections.hashtable(v=vs.110).aspx
Hope thjs works for you