C# hash

HashSet<T> is a generic class which contains an unordered collection of elements. The elements are stored using their hashcodes, thus it provides faster speed for Collection standard methods include Remove, Contains etc.

using System.Collections.Generic;
HashSet<int> hs = new HashSet<int>();
hs.Add(3);
hs.Add(4);
hs.Add(5);
hs.Count; //3

Loop through a HashSet:
foreach (int i in hs)
{
...
}

Hashtable is a class similar to the hashmap in other languages. It contains a collection of key value pairs, and provides faster methods include Remove, Contains etc.
Hashtable ht = new Hashtable();
ht.Add("Houston", 5);
ht.Add("Boston", 9);
ht.Add("London", 12);
ht.ContainsKey("Boston"); //true
ht["London"]; //12

Loop through a Hashtable:
for (string ky in hs.Keys)
{
int val = hs[key];
}