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

定義

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

property System::Object ^ System::Collections::IList::Item[int] { System::Object ^ get(int index); void set(int index, System::Object ^ value); };
object System.Collections.IList.Item[int index] { get; set; }
object? System.Collections.IList.Item[int index] { get; set; }
member this.System.Collections.IList.Item(int) : obj with get, set
 Property Item(index As Integer) As Object Implements IList.Item

參數

index
Int32

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

屬性值

在指定索引上的項目。

實作

例外狀況

index 不是 IList 中的有效索引。

屬性已設定,且 value 具有無法指派給 IList 的型別。

備註

C# 語言會使用此 關鍵字來定義索引子,而不是實作 IList.Item[] 屬性。 Visual Basic 會將 IList.Item[] 實作為預設屬性,這樣會提供相同的索引功能。

擷取此屬性的值是 O (1) 作業;設定 屬性也是 O (1) 作業。

適用於