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

定義

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

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; }
 Property Item(index As Integer) As Object Implements IList.Item

參數

index
Int32 Int32 Int32

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

屬性值

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

實作

例外狀況

index 不是 IList 中的有效索引。index is not a valid index in the IList.

屬性已設定,且 value 具有無法指派給 IList 的型別。The property is set and value is of a type that is not assignable to the IList.

備註

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

抓取這個屬性的值是 O (1) 運算;設定屬性也是 O (1) 運算。Retrieving the value of this property is an O(1) operation; setting the property is also an O(1) operation.

適用於