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


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

Updated on: 23-Jun-2020

74 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements