What is the IsFixedSize property of ArrayList class 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 18-Sep-2018 08:20:54
Advertisements