The IsReadOnly property of Hashtable class is used to get a value indicating whether the Hashtable is read-only.
Example
using System;
using System.Collections;
namespace Demo {
class Program {
static void Main(string[] args) {
Hashtable ht = new Hashtable();
ht.Add("One", "Amit");
ht.Add("Two", "Aman");
ht.Add("Three", "Raman");
Console.WriteLine("IsReadOnly = " + ht.IsReadOnly);
Console.ReadKey();
}
}
}Output
IsReadOnly = False
Above we have set a Hashtable with three elements.
ht.Add("One", "Amit");
ht.Add("Two", "Aman");
ht.Add("Three", "Raman");After that, we have checked using the IsReadOnly property.
Console.WriteLine("IsReadOnly = " + ht.IsReadOnly);