VOOZH about

URL: https://www.geeksforgeeks.org/c-sharp/c-sharp-check-if-hashtable-is-read-only/

⇱ C# | Check if Hashtable is read-only - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

C# | Check if Hashtable is read-only

Last Updated : 11 Jul, 2025
Hashtable.IsReadOnly property is used to get a value indicating whether the Hashtable is read-only or not. Syntax:
public virtual bool IsReadOnly { get; }
Return Value: This property returns true if the Hashtable is read-only otherwise it returns false. The default is false. Below programs illustrate the above-discussed property: Example 1:
Output:
False
Example 2:
Output:
False
Note:
  • A collection that is read-only does not allow the addition, removal, or modification of elements after the collection is created.
  • A collection that is read-only is simply a collection with a wrapper that prevents modifying the collection. Therefore, if changes are made to the underlying collection, the read-only collection reflects those changes.
  • Retrieving the value of this property is an O(1) operation.
Reference:
Comment

Explore