Convert a list to comma separated string without loop

I have a list with string values. I want to store all values from my list to a variable with comma separated without using loop.


Hello, @kadiravan_kalidoss! This can be made using some code and some specific methods. Just take a look over these:
VB.NET Convert List to String - Dot Net Perls - Convert List of String to a String separated by a delimiter - Stack Overflow
Basically, this should work:

String.Join(",", myListOfStrings.ToArray())

I think I did this at a certain point, if those links don’t help you just let me know and I can actually look for it and find the solution when I have a bit of time.


it works flawlessly…!

Same way can we convert a datatable column values to comma separated string? Without using loop!

1 Like

Awesome that it worked! For datatable column values to a string without using a loop you can also use a line of code:

dataTable.AsEnumerable().[Select](Function(x) x("Column1").ToString()).Aggregate(Function(a, b) String.Concat(a, "," & b))

Let me know if it works for you!


Thank you !!
its working fine…!


This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.