Dictionary<TKey,TValue>.IDictionary.IsReadOnly Dictionary<TKey,TValue>.IDictionary.IsReadOnly Dictionary<TKey,TValue>.IDictionary.IsReadOnly Property


获取一个值,该值指示 IDictionary 是否为只读。Gets a value that indicates whether the IDictionary is read-only.

property bool System::Collections::IDictionary::IsReadOnly { bool get(); };
bool System.Collections.IDictionary.IsReadOnly { get; }
 ReadOnly Property IsReadOnly As Boolean Implements IDictionary.IsReadOnly


如果 true 是只读的,则为 IDictionary;否则为 falsetrue if the IDictionary is read-only; otherwise, false. Dictionary<TKey,TValue> 的默认实现中,此属性始终返回 falseIn the default implementation of Dictionary<TKey,TValue>, this property always returns false.



在创建只读集合后,该集合不允许添加、移除或修改元素。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.

获取此属性的值的运算复杂度为 O (1)。Getting the value of this property is an O(1) operation.