Copia os elementos do Objeto ArrayList para uma nova matriz.
Sintaxe
Object.ToArray()
Argumentos - Object: Obrigatório. Sempre o nome do objeto ArrayList.
Retorna
Uma matriz com cópias dos elementos do objeto ArrayList
Comentários
O exemplo a seguir ilustra o uso do método ToArray.
Exemplo 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