IList.Item 属性

获取或设置指定索引处的元素。

**命名空间:**System.Collections
**程序集:**mscorlib(在 mscorlib.dll 中)

语法

声明
Default Property Item ( _
    index As Integer _
) As Object
用法
Dim instance As IList
Dim index As Integer
Dim value As Object

value = instance(index)

instance(index) = value
Object this [
    int index
] { get; set; }
property Object^ default [int] {
    Object^ get (int index);
    void set (int index, Object^ value);
}
/** @property */
Object get_Item (int index)

/** @property */
void set_Item (int index, Object value)
JScript 支持使用索引属性,但不支持进行新的声明。

参数

  • index
    要获得或设置的元素从零开始的索引。

属性值

指定索引处的元素。

异常

异常类型 条件

ArgumentOutOfRangeException

index 不是 IList 中的有效索引。

NotSupportedException

设置该属性,而且 IList 为只读。

备注

通过使用下面的语法,此属性提供访问集合中特定元素的能力:myCollection[index]

平台

Windows 98、Windows 2000 SP4、Windows CE、Windows Millennium Edition、Windows Mobile for Pocket PC、Windows Mobile for Smartphone、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition

.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求

版本信息

.NET Framework

受以下版本支持:2.0、1.1、1.0

.NET Compact Framework

受以下版本支持:2.0、1.0

请参见

参考

IList 接口
IList 成员
System.Collections 命名空间