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: 2020-06-23T11:48:23+05:30

123 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements