Create a comma separated list with LINQ in C#

For some reason I always forget that you do not do .Join on your actual string array. So i might as well write it down here so i never forget about this again.

string mycommalist = string.Join(",", alternatives.Select(x=>x.Item.Name).ToArray())

Leave a Reply