지정된 인덱스의 요소를 ArrayList 객체에서 가져오거나 설정합니다.
구문
Object.Item(Index)
인수:
Object: 필수. 항상 ArrayList 객체의 이름입니다.
Index: 필수. 가져올 요소의 0부터 시작하는 인덱스입니다.
반환
인덱스 내의 요소를 반환합니다.
주석
다음 예에서는 Item 메소드의 사용을 보여 줍니다.
예 1:
'Create ArrayList Object
Dim Obj
Set Obj = CreateObject("System.Collections.ArrayList")
'Add Elements to the end of ArrayList Object
Dim Index
Index = Obj.Add(10)
Index = Obj.Add(40)
Index = Obj.Add(20)
'Output: Obj contains 10, 40, 20
'Gets the Element from the ArrayList Object
Dim Element
Index = 2
If Index < Obj.Count() Then
Element = Obj.Item(Index)
'Output: 20
End If
'Set the Element in the ArrayList Object
Index = 1
If Index < Obj.Count() Then
Obj.Item(Index) = 15
End If
'Output: Obj contains 10, 15, 20