
- C# Basic Tutorial
- C# - Home
- C# - Overview
- C# - Environment
- C# - Program Structure
- C# - Basic Syntax
- C# - Data Types
- C# - Type Conversion
- C# - Variables
- C# - Constants
- C# - Operators
- C# - Decision Making
- C# - Loops
- C# - Encapsulation
- C# - Methods
- C# - Nullables
- C# - Arrays
- C# - Strings
- C# - Structure
- C# - Enums
- C# - Classes
- C# - Inheritance
- C# - Polymorphism
- C# - Operator Overloading
- C# - Interfaces
- C# - Namespaces
- C# - Preprocessor Directives
- C# - Regular Expressions
- C# - Exception Handling
- C# - File I/O
- C# Advanced Tutorial
- C# - Attributes
- C# - Reflection
- C# - Properties
- C# - Indexers
- C# - Delegates
- C# - Events
- C# - Collections
- C# - Generics
- C# - Anonymous Methods
- C# - Unsafe Codes
- C# - Multithreading
- C# Useful Resources
- C# - Questions and Answers
- C# - Quick Guide
- C# - Useful Resources
- C# - Discussion
What does Array.IsReadOnly property of array class do in C#?
The Array.IsReadOnly property gets a value indicating whether the Array is read-only.
Firstly, set the array values −
Array arr = Array.CreateInstance(typeof(String), 3); arr.SetValue("Electronics", 0); arr.SetValue("Clothing", 1);
Now let’s use the IsReadOnly property to find whether the Array is read-only. If the array is read-only, then it cannot be updated −
arr.IsReadOnly
The following is the complete example stating the usage of Array.IsReadOnly property −
Example
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace lower { class Program { static void Main(string[] args) { Array arr = Array.CreateInstance(typeof(String), 3); arr.SetValue("Electronics", 0); arr.SetValue("Clothing", 1); Console.WriteLine("Lower Bound: {0}",arr.GetLowerBound(0).ToString()); Console.WriteLine("isReadOnly: {0}",arr.IsReadOnly.ToString()); Console.ReadLine(); } } }
Output
Lower Bound: 0 isReadOnly: False
- Related Articles
- What does Array.Rank property of array class do in C#?
- What does Array.IsFixedSize property of array class do in C# ?
- What does Array.Length property of array class do in C#?
- What does Array.LongLength property of array class do in C#?
- What does Array.IsSynchronized property of array class do in C#?
- What does Array.SyncRoot property of array class do in C#?
- What does a semicolon do after a C++ class name?
- What does built-in class attribute __dict__ do in Python?
- What does built-in class attribute __doc__ do in Python?
- What does built-in class attribute __module__ do in Python?
- What does built-in class attribute __bases__ do in Python?
- What is the Count property of ArrayList class in C#?
- What is the Capacity property of SortedList class in C#?
- What is the Count property of BitArray class in C#?
- What is the Count property of Hashtable class in C#?

Advertisements