What does Array.IsFixedSize property of array class do 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: 20-Jun-2020

172 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements