ArrayList Learn programming Visual Basic (VB.net)

Lesson:

Dynamic Memory Management


Exercise:

ArrayList 64


Objetive:

Create a list of strings, using the class ArrayList which already exists in the DotNet Platform.

Once created, show all the items stored in the list.
Insert one new item in the second place of the list and then show again all the items checking if the insertion was correct.


Code:

Imports System
Imports System.Collections
Namespace List
    Class Program
        Private Shared Sub Main(ByVal args As String())
            Dim miLista As ArrayList = New ArrayList()
            miLista.Add("Hola,")
            miLista.Add("soy")
            miLista.Add("yo")

            For Each frase As String In miLista
                Console.WriteLine(frase)
            Next

            miLista.Insert(1, "Como estas?")
        End Sub
    End Class
End Namespace