How to remove all the elements from Hashtable in C#

1 Answer

0 votes
using System;
using System.Collections; 
                      
public class Program
{
    public static void Main()
    {
 		Hashtable ht = new Hashtable(); 
  
        ht.Add("c", "c#"); 
        ht.Add("a", "c++"); 
        ht.Add("d", "java"); 
        ht.Add("e", "c");         
		ht.Add("b", "php"); 
		
        Console.WriteLine(ht.Count); 

		ht.Clear(); 
  
        Console.WriteLine(ht.Count); 
    }
}
  



/*
run:
  
5
0
  
*/

 



answered May 10, 2020 by avibootz

Related questions

1 answer 159 views
2 answers 205 views
1 answer 140 views
1 answer 164 views
1 answer 162 views
162 views asked Feb 20, 2017 by avibootz
...