Metodo Item

Restituisce o imposta l'elemento nell'indice specificato dall'oggetto ArrayList.

Sintassi

Object.Item(Index)

Argomenti:

  • Object: obbligatorio. Sempre il nome dell'oggetto ArrayList.

  • Index: obbligatorio. Indice su base zero dell'elemento da restituire.

Valore restituito

Restituisce l'elemento incluso nell'indice.

Note

Nell'esempio seguente viene illustrato l'uso del metodo Item.

Esempio 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