A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/c-sharp/c-sharp-check-if-the-arraylist-is-read-only/ below:

C# | Check if the ArrayList is read-only

C# | Check if the ArrayList is read-only

Last Updated : 11 Jul, 2025

ArrayList

represents an ordered collection of an object that can be indexed individually. It is basically an alternative to an array. It also allows dynamic memory allocation, adding, searching and sorting items in the list.

ArrayList.IsReadOnly

property is used to check whether the ArrayList is read-only or not.

Properties: Syntax:
public virtual bool IsReadOnly { get; }
Return Value:

This method returns

True

if the ArrayList is read-only, otherwise returns

False

. The default value is

False

.

Example: CSHARP
// C# code to check if the ArrayList
// is read-only or not
using System;
using System.Collections;
using System.Collections.Generic;

class GFG {

    // Driver code
    public static void Main()
    {

        // Creating an ArrayList
        ArrayList myList = new ArrayList();

        // Adding elements to ArrayList
        myList.Add("Geeks");
        myList.Add("for");
        myList.Add("Geeks");
        myList.Add("Noida");
        myList.Add("Geeks Classes");
        myList.Add("Delhi");

        // To check if the ArrayList is read-only or not
        Console.WriteLine(myList.IsReadOnly);
    }
}
Note: Reference:

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4