
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Array IsReadOnly Property 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
Advertisements