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

CsharpProgrammingServer Side Programming

The IsReadOnly property of ArrayList class is useful to get a value indicating whether the ArrayList is read-only.

Firstly, we have the following ArrayList.

ArrayList arrList = new ArrayList();

Then we have checked using the IsReadOnly Property.

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

The following is an example showing how to work with IsReadOnly property in ArrayList class.

Example

 Live Demo

using System;
using System.Collections;
class Demo {
   public static void Main() {
      ArrayList arrList = new ArrayList();
      Console.WriteLine("myArrayList.IsReadOnly = " + arrList.IsReadOnly);
   }
}

Output

myArrayList.IsReadOnly = False
raja
Published on 18-Sep-2018 08:25:30
Advertisements