I have a list like this
Dim emailList as new List(Of String)
emailList.Add("[email protected]")
emailList.Add("[email protected]")
emaillist.Add("[email protected]")
How can I iterate the list with ForEach to get one string with the emails like this
[email protected];[email protected];[email protected]
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