Remove all elements from the Hashtable in CSharp
Description
The following code shows how to remove all elements from the Hashtable.
Example
using System;//ww w.ja v a2s .c o m
using System.Collections;
public class SamplesHashtable {
public static void Main() {
Hashtable myHT = new Hashtable();
myHT.Add( "one", "1" );
Console.WriteLine(myHT.Count );
myHT.Clear();
Console.WriteLine(myHT.Count );
}
}
The code above generates the following result.