![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the IsReadOnly property of SortedList class in C#?
Use the IsReadOnly property to get a value indicating whether the SortedList is read-only or not.
You can try to run the following code to implement IsReadOnly property in C#.
Here, we have set the SortedList first.
SortedList s = new SortedList();
Added elements.
s.Add("S001", "Jack"); s.Add("S002", "Henry");
Now check for IsReadOnly.
Console.WriteLine("IsReadOnly = " + s.IsReadOnly);
The following is the complete code.
Example
using System; using System.Collections; namespace Demo { class Program { static void Main(string[] args) { SortedList s = new SortedList(); s.Add("S001", "Jack"); s.Add("S002", "Henry"); Console.WriteLine("IsReadOnly = " + s.IsReadOnly); } } }
Output
IsReadOnly = False
Advertisements