ArrayList.ToArray() : ArrayList « System.Collections « VB.Net by API






ArrayList.ToArray()

  

Imports System
Imports System.Collections


Public Class MainClass
    
    Shared Sub Main(ByVal args As String())
        Dim array_list As New ArrayList
        array_list.Add("A")
        array_list.Add("B")
        array_list.Add("C")

        ' Array of objects.
        Dim obj_array() As Object
        obj_array = array_list.ToArray()

        ' Array of strings.
        Dim string_array() As String
        string_array = DirectCast(array_list.ToArray(GetType(String)), String())

        ' Array object of objects.
        Dim astring_array As Array
        astring_array = array_list.ToArray()


    End Sub

End Class

   
    
  








Related examples in the same category

1.ArrayList.Add
2.ArrayList.Capacity
3.ArrayList.Contains
4.ArrayList.Count
5.ArrayList.GetEnumerator
6.ArrayList.IndexOf
7.ArrayList.Remove
8.ArrayList.TrimToSize