Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Prodentim Probiotics Specially Designed For The Health Of Your Teeth And Gums

Instant Grammar Checker - Correct all grammar errors and enhance your writing

Teach Your Child To Read

Powerful WordPress hosting for WordPress professionals

Disclosure: My content contains affiliate links.

31,104 questions

40,777 answers

573 users

How to repeat a string N times into an array using Linq in VB.NET

Learn & Practice SQL


87 views
asked Mar 9, 2021 by avibootz
edited Mar 11, 2021 by avibootz

1 Answer

0 votes
Imports System
Imports System.Linq

Public Module Module1
	Public Sub Main()
		Dim s As String = "vb.net"
		
		Dim N As Integer = 3
		Dim arr = From w In Enumerable.Repeat(s, N)
		
		For Each str As String In arr
        	Console.WriteLine(str)
    	Next
	End Sub
End Module



' run:
'
' vb.net
' vb.net
' vb.net
' 

 





answered Mar 9, 2021 by avibootz
...