IList<T>.Item[Int32] 屬性

定義

在指定的索引位置上取得或設定項目。

public:
 property T default[int] { T get(int index); void set(int index, T value); };
public T this[int index] { get; set; }
member this.Item(int) : 'T with get, set
Default Public Property Item(index As Integer) As T

參數

index
Int32

要取得或設定的以零為起始元素索引。

屬性值

T

在指定索引上的項目。

例外狀況

index 不是 IList<T> 中的有效索引。

屬性已設定,而且 IList<T> 是唯讀的。

備註

這個屬性可透過下列語法存取集合中的特定元素:myCollection[index]

C# 語言會使用此 關鍵詞來定義索引器,而不是實作 Item[] 屬性。 Visual Basic 會實作為Item[]預設屬性,以提供相同的索引功能。

適用於

另請參閱