Collection<T>.IList.IsReadOnly 属性

定义

获取一个值,该值指示 IList 是否为只读。

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

属性值

Boolean

如果 true 是只读的,则为 IList;否则为 false。 在 Collection<T> 的默认实现中,此属性始终返回 false

实现

注解

在创建只读集合后,该集合不允许添加、移除或修改元素。

只读的集合只是一个包含包装器的集合,该集合阻止修改集合;因此,如果对基础集合进行了更改,只读集合将反映这些更改。

检索此属性的值的运算复杂度为 O(1)。

适用于