次の方法で共有


ArrayList.Item プロパティ

指定したインデックスにある要素を取得または設定します。

[C#] C# では、このプロパティは ArrayList クラスのインデクサになります。

Public Overridable Default Property Item( _
   ByVal index As Integer _) As Object  Implements IList.Item
[C#]
public virtual object this[intindex] {get; set;}
[C++]
public: __property virtual Object* get_Item(intindex);public: __property virtual void set_Item(intindex,   Object*);
[JScript]
returnValue = ArrayListObject.Item(index);ArrayListObject.Item(index) = returnValue;またはreturnValue = ArrayListObject(index);ArrayListObject(index) = returnValue;

[JScript] JScript では、この型で定義されている既定のインデックス プロパティを使用することができます。しかし、独自のインデックス プロパティを明示的に定義することはできません。ただし、このクラスの expando 属性を指定すると、既定のインデックス プロパティが提供されます。提供されるインデックス プロパティの型は Object 型であり、インデックス型は String になります。

引数 [JScript]

  • index
    取得または設定する要素の、0 から始まるインデックス番号。

パラメータ [Visual Basic, C#, C++]

  • index
    取得または設定する要素の、0 から始まるインデックス番号。

プロパティ値

指定したインデックスにある要素。

実装

IList.Item

例外

例外の種類 条件
ArgumentOutOfRangeException index が 0 未満です。

または

index が Count 以上です。

解説

ArrayList は、 null 参照 (Visual Basic では Nothing) を有効な値として受け取り、要素の重複を許可します。

このプロパティでは、 myCollection[index] という構文を使用して、コレクション内の特定の要素にアクセスできます。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, Common Language Infrastructure (CLI) Standard

参照

ArrayList クラス | ArrayList メンバ | System.Collections 名前空間 | Count