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


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

 property bool IsReadOnly { bool get(); };
public bool IsReadOnly { get; }
member this.IsReadOnly : bool
Public ReadOnly Property IsReadOnly As Boolean


如果 true 是唯讀,則為 ICollection<T>,否則為 falsetrue if the ICollection<T> is read-only; otherwise, false.


集合是唯讀的不允許的集合建立後新增或移除項目。A collection that is read-only does not allow the addition or removal of elements after the collection is created. 請注意,唯讀模式在此內容中不會指出是否將集合的個別元素可以修改,因為ICollection<T>介面僅支援加入和移除作業。Note that read-only in this context does not indicate whether individual elements of the collection can be modified, since the ICollection<T> interface only supports addition and removal operations. 例如,IsReadOnly屬性的陣列,其中是轉型或轉換成ICollection<T>物件會傳回true,即使可以修改個別陣列元素。For example, the IsReadOnly property of an array that is cast or converted to an ICollection<T> object returns true, even though individual array elements can be modified.