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修改個別陣列元素true, 轉換或轉換ICollection<T>成物件之陣列的屬性也會傳回。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.