Converting Array or List of data to String => made easy! (C#, MVC3, LINQ)
string.Join(",...
string.Join(",", Array.ConvertAll(cities, c => c.Name));A Linq solution that works under .NET 3.5 is:
string.Join(",", cities.Select(c => c.Name).ToArray());This is less efficient than
ConvertAll
because it is iterating through the array via the IEnumerable
interface.