How to create a collection of repeated elements in VB.NET

1 Answer

0 votes
Imports System
Imports System.Linq

Public Module Module1
	Public Sub Main()
		Dim str As String = "VB.NET"

		Dim result = From s In Enumerable.Repeat(str, 5)

		For Each item As String In result
		Console.WriteLine(item)
    	Next
	End Sub
End Module



' run:
'
' VB.NET
' VB.NET
' VB.NET
' VB.NET
' VB.NET
'

 



answered Dec 29, 2022 by avibootz
...