What is the IsFixedSize property of Hashtable class in C#?

Use the isFixedSize property of Hashtable class to get a value indicating whether the Hashtable has a fixed size.

The following is an example showing how to work with IsFixedSize property.


 Live Demo

using System;
using System.Collections;
namespace Demo {
   class Program {
      static void Main(string[] args) {
         Hashtable ht = new Hashtable();
         ht.Add("D01", "Finance");
         ht.Add("D02", "HR");
         ht.Add("D03", "Operations");
         Console.WriteLine("IsFixedSize = " + ht.IsFixedSize);


IsFixedSize = False

Above we have added Hashtable collection.

Hashtable ht = new Hashtable();

Then after adding elements, we have checked that whether it has a fixed size or not using the isFixedSize property.

karthikeya Boyini
karthikeya Boyini

I love programming (: That's all I know