SortedSet<T>.ICollection<T>.IsReadOnly 属性

定义

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

property bool System::Collections::Generic::ICollection<T>::IsReadOnly { bool get(); };
bool System.Collections.Generic.ICollection<T>.IsReadOnly { get; }
member this.System.Collections.Generic.ICollection<T>.IsReadOnly : bool
 ReadOnly Property IsReadOnly As Boolean Implements ICollection(Of T).IsReadOnly

属性值

Boolean

如果该集合为只读,则为 true;否则为 falsetrue if the collection is read-only; otherwise, false.

实现

注解

此成员是显式接口成员的实现。This member is an explicit interface member implementation. 它只能在 SortedSet<T> 实例被强制转换为 ICollection<T> 接口时使用。It can be used only when the SortedSet<T> instance is cast to an ICollection<T> interface.

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

适用于