How to create and print a List of integers in VB.NET

2 Answers

0 votes
Module Module1

    Sub Main()

        Dim list As New List(Of Integer)

        list.Add(1)
        list.Add(43)
        list.Add(7)
        list.Add(999)
        list.Add(10101)

        For Each n In list
            Console.WriteLine(n)
        Next

    End Sub

End Module

' run:
' 
' 1
' 43
' 7
' 999
' 10101

 



answered Feb 1, 2017 by avibootz
0 votes
Module Module1

    Sub Main()

        Dim list As New List(Of Integer)

        list.Add(1)
        list.Add(43)
        list.Add(7)
        list.Add(999)
        list.Add(10101)

        Dim i As Integer
        For i = 0 To list.Count - 1
            Console.WriteLine(list.Item(i))
        Next i

    End Sub

End Module

' run:
' 
' 1
' 43
' 7
' 999
' 10101

 



answered Feb 1, 2017 by avibootz

Related questions

...