I have a list like this
Dim emailList as new List(Of String)
emailList.Add("one@domain.com")
emailList.Add("two@domain.com")
emaillist.Add("three@domain.com")
How can I iterate the list with ForEach to get one string with the emails like this
one@domain.com;two@domain.com;three@domain.com
I'm not sure why you would want to use a foreach instead of a String.Join statement. You could simply String.Join() the list using a semi-colon as your joining character.
String.Join(";", emailList.ToArray())
You can try
Dim stringValue As String = String.Join(";", emailList.ToArray)
Have a look at String.Join Method
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With