Remove the element with the specified key from the Hashtable in CSharp
Description
The following code shows how to remove the element with the specified key from the Hashtable.
Example
using System;/*from ww w . j av a2 s . c o m*/
using System.Collections;
class MainClass
{
static void Main(string[] args)
{
Hashtable a = new Hashtable(10);
a.Add(100, "A");
a.Add(200, "C");
foreach (string firstName in a.Keys)
{
Console.WriteLine("{0} {1}", firstName, a[firstName]);
}
a.Remove(100);
a.Remove(200);
Console.WriteLine(a.Count);
}
}