陣列集合ArrayList (VB.NET)

陣列集合ArrayList (VB.NET)


    Sub Main()
        Dim list As New ArrayList
        List.Add(123)
        List.Add("String")
        List.Add(True)
        List.AddRange(New Integer() {1, 2, 3, 4})
        Console.WriteLine(list(1))
        Console.WriteLine("----------------------------------------")

        Dim list2 As New ArrayList(New Integer() {1, 2, 3, 4})
        Console.WriteLine(list2(2))
        Console.WriteLine(list2.Capacity)
        Console.WriteLine(list2.Count)
        Console.WriteLine("----------------------------------------")
        list2.RemoveAt(2)
        Console.WriteLine(list2(2))
        Console.WriteLine(list2.Capacity)
        Console.WriteLine(list2.Count)

    End Sub


如有錯誤 歡迎指正