List<T>.ICollection<T>.IsReadOnly List<T>.ICollection<T>.IsReadOnly List<T>.ICollection<T>.IsReadOnly Property

定義

取得值,指出 ICollection<T> 是否唯讀。Gets a value indicating whether the ICollection<T> is read-only.

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

屬性值

如果 true 是唯讀,則為 ICollection<T>,否則為 falsetrue if the ICollection<T> is read-only; otherwise, false. List<T> 的預設實作中,這個屬性永遠會傳回 falseIn the default implementation of List<T>, 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) 運算。Retrieving the value of this property is an O(1) operation.

適用於