How to create and use a list of integers in VB.NET

2 Answers

0 votes
Module Module1

    Sub Main()

        Dim list As New List(Of Integer)

        list.Add(4)
        list.Add(5)
        list.Add(9)
        list.Add(16)
        list.Add(99)

        For Each item As Integer In list
            Console.WriteLine(item)
        Next

    End Sub

End Module

' run:
' 
' 4
' 5
' 9
' 16
' 99

 



answered Sep 26, 2018 by avibootz
0 votes
Module Module1

    Sub Main()

        Dim list As New List(Of Integer)

        list.Add(4)
        list.Add(5)
        list.Add(9)
        list.Add(16)
        list.Add(99)

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

    End Sub

End Module

' run:
' 
' 4
' 5
' 9
' 16
' 99

 



answered Sep 26, 2018 by avibootz

Related questions

2 answers 206 views
2 answers 235 views
1 answer 176 views
1 answer 188 views
2 answers 246 views
...