The Situation:
You have a List<string> and need to convert it to a comma-delimited list (for display or storage).
A Solution:
This is a great example of how C# has improved over the years. I found this solution in this StackOverflow discussion and don’t want to lose it, so I am copying it here for reference.
List<string> strings = <code>...; // .NET 2.0: string joined = string.Join(",", new List<string>(strings).ToArray()); // .NET 3.5: string joined = string.Join(",", strings.ToArray()); // .NET 4.0: string joined = string.Join(",", strings);
Thanks to Jon Skeet, Xavier Poinas and the rest of the guys that participated in that discussion. Gotta love StackOverflow!