What does Array.IsFixedSize property of array class do in C# ?

CsharpProgrammingServer Side Programming

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);
raja
Published on 08-Aug-2018 08:54:59
Advertisements