C# ArrayList IsReadOnly

Description

ArrayList IsReadOnly gets a value indicating whether the ArrayList is read-only.

Syntax

ArrayList.IsReadOnly has the following syntax.


public virtual bool IsReadOnly { get; }

Example


using System; // w  w w .  ja  v  a 2  s  .  co  m
using System.Collections; 
 
class MainClass { 
  public static void Main() { 
    ArrayList al = new ArrayList(); 
     
    Console.WriteLine("Initial number of elements: " + al.Count); 
 
    Console.WriteLine("Adding 6 elements"); 
    // Add elements to the array list 
    al.Add('C'); 
    al.Add('A'); 
    al.Add('E'); 
    al.Add('B'); 
    al.Add('D'); 
    al.Add('F'); 
 
    Console.WriteLine(al.IsReadOnly); 
  }
} 

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Collections »




ArrayList
BitArray
Comparer
Hashtable
Queue
SortedList
Stack