How to fix the size of the Hashtable and find the whether it has fix size or not?
- by Vijjendra
Hi All,
I am trying to fix the size of the Hashtable with following code.
Hashtable hashtable = new Hashtable(2);
//Add elements in the Hashtable
hashtable.Add("A", "Vijendra");
hashtable.Add("B", "Singh");
hashtable.Add("C", "Shakya");
hashtable.Add("D", "Delhi");
hashtable.Add("E", "Singh");
hashtable.Add("F", "Shakya");
hashtable.Add("G", "Delhi");
hashtable.Add("H", "Singh");
hashtable.Add("I", "Shakya");
hashtable.Add("J", "Delhi");
I have fix the size of this Hashtable is 2 but I can add more than 2 elements in this, why this happen, I am doing somthing wrong?
I have tried to find out is this Hashtable have fix size of not with hashtable.IsFixedSize, it always returns false
Please tell me where I am wrong, or there is another way..