IList<T>.Item[Int32] IList<T>.Item[Int32] IList<T>.Item[Int32] IList<T>.Item[Int32] Property

定義

在指定的索引位置上取得或設定項目。Gets or sets the element at the specified index.

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 Int32 Int32 Int32

要取得或設定之以零為起始的項目索引。The zero-based index of the element to get or set.

屬性值

T T T T

在指定索引上的項目。The element at the specified index.

例外狀況

屬性已設定,而且 IList<T> 是唯讀的。The property is set and the IList<T> is read-only.

備註

這個屬性可以使用下列語法提供存取集合中特定元素的能力:myCollection[index]This property provides the ability to access a specific element in the collection by using the following syntax: myCollection[index].

C# 語言使用關鍵字來定義索引,而不必實作Item[Int32]屬性。The C# language uses the keyword to define the indexers instead of implementing the Item[Int32] property. Visual Basic 會將 Item[Int32] 實作為預設屬性,這樣會提供相同的索引功能。Visual Basic implements Item[Int32] as a default property, which provides the same indexing functionality.

適用於

另請參閱