How to iterate over a list in VB.NET

1 Answer

0 votes
Imports System
Imports System.Collections.Generic

Public Class Example
    Public Shared Sub Main(ByVal args As String())
        Dim list As List(Of Integer) = New List(Of Integer)() From {
            5,
            3,
            6,
            7,
            1,
            9,
            8
        }

        For Each val In list
            Console.Write(val & " ")
        Next
    End Sub
End Class




' run:
'
' 5 3 6 7 1 9 8
'

 



answered Dec 28, 2022 by avibootz

Related questions

...