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.

Example

 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);
         Console.ReadKey();
      }
   }
}

Output

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.

ht.IsFixedSize

karthikeya Boyini
karthikeya Boyini

I love programming (: That's all I know

Updated on: 23-Jun-2020

56 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements