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-stringcollection-is-read-only/ below:

C# | Check if the StringCollection is read-only

C# | Check if the StringCollection is read-only

Last Updated : 11 Jul, 2025

StringCollection class is a new addition to the .NET Framework class library that represents a collection of strings. StringCollection class is defined in the

System.Collections.Specialized

namespace.

StringCollection.IsReadOnly

property is used to get a value indicating whether the StringCollection is read-only or not.

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

This property always returns false.

Note: Example: CSHARP
// C# code to check if the
// StringCollection is read-only
using System;
using System.Collections;
using System.Collections.Specialized;

class GFG {

    // Driver code
    public static void Main()
    {

        // creating a StringCollection named myCol
        StringCollection myCol = new StringCollection();

        // creating a string array named myArr
        String[] myArr = new String[] { "A", "B", "C", "D", "E" };

        // Copying the elements of a string
        // array to the end of the StringCollection.
        myCol.AddRange(myArr);

        // checking if StringCollection is
        // read-only
        Console.WriteLine(myCol.IsReadOnly);
    }
}
Output:
False
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