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

2 Answers

0 votes
Imports System
Imports System.Collections.Generic
				
Public Module Module1
	Public Sub Main()
		Dim list As New List(Of Integer)(New Integer() {1, 6, 23, 88, 100})
 
        For Each n As Integer In list
            Console.WriteLine(n)
        Next
	End Sub
End Module



' run:
'
' 1
' 6
' 23
' 88
' 100
' 

 



answered Sep 26, 2018 by avibootz
edited May 5, 2020 by avibootz
0 votes
Imports System
				
Public Module Module1
	Public Sub Main()
		Dim lst As New System.Collections.Generic.List(Of Integer)(New Integer() { 1, 6, 98 })
 
		For Each n As Integer In lst
            Console.WriteLine(n)
        Next
	End Sub
End Module



' run:
'
' 1
' 6
' 98
' 

 



answered May 5, 2020 by avibootz
...