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


The IsFixedSize property of ArrayList class is used to get a value indicating whether the ArrayList has a fixed size.

The following is an example stating the usage of isFixedSize property.

Example

 Live Demo

using System;
using System.Collections;
class Demo {
   public static void Main() {
      ArrayList arrList = new ArrayList();
      Console.WriteLine("Adding some numbers:");
      arrList.Add(45);
      arrList.Add(78);
      Console.WriteLine(arrList.Count);
      Console.WriteLine("myArrayList.IsFixedSize = " + arrList.IsFixedSize);
   }
}

Output

Adding some numbers:
2
myArrayList.IsFixedSize = False

Above we have added an array list.

ArrayList arrList = new ArrayList();

Then we have checked whether it has a fixed size or not.

Console.WriteLine("myArrayList.IsFixedSize = " + arrList.IsFixedSize);

Updated on: 23-Jun-2020

81 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements