Copia gli elementi dell'oggetto ArrayList in un nuovo array.
Sintassi
Object.ToArray()
Argomenti - Object: obbligatorio. Sempre il nome dell'oggetto ArrayList.
Valore restituito
Array contenente copie degli elementi dell'oggetto ArrayList.
Note
Nell'esempio seguente viene illustrato l'uso del metodo ToArray.
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)
Index = Obj.Add(30)
'Copies the elements of the ArrayList object to a new array
Dim ArrObj
ArrObj = Obj.ToArray()
'Display Elements from Array
For Each Element In ArrObj
'Operation based on requirement using each element of Array
Next
'Output: ArrObj contains 10, 40, 20, 30