ReadOnlyCollection<T>.IList<T>.Item[Int32] 屬性

定義

取得位在指定索引處的元素。 如果您嘗試在指定索引處設定項目,就會發生 NotSupportedException

property T System::Collections::Generic::IList<T>::Item[int] { T get(int index); void set(int index, T value); };
T System.Collections.Generic.IList<T>.Item[int index] { get; set; }
member this.System.Collections.Generic.IList<T>.Item(int) : 'T with get, set
 Property Item(index As Integer) As T Implements IList(Of T).Item

參數

index
Int32

要取得之項目的以零為起始的索引。

屬性值

T

在指定索引上的項目。

實作

例外狀況

如果屬性已設定,則一定會擲回。

備註

因為集合是只讀的,所以您只能在指定的索引取得這個專案。 如果您嘗試設定專案,就會發生例外狀況。 這個成員是明確介面成員實作, 只有在 ReadOnlyCollection<T> 執行個體轉換成 IList<T> 介面時,才能使用這個成員。

適用於