List<long> to comma delimited string in C# -


this comes up. have list , want go comma delimited string of elements in list can use in sql.

what elegant way in c#? iterating on of them fine, except either first or last element has special-cased since don't want leading or trailing commas.

got one-liner?

string.join friend...

var list = new list<long> {1, 2, 3, 4}; var commaseparated = string.join(",", list); 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -