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> 接口时使用。

适用于