How to convert IEnumerable<string> to one comma separated string?
using System;
using System.Collections.Generic;
using System.Linq;
class C
{
public static void Main()
{
var a = new []{
"First", "Second", "Third"
};
System.Console.Write(string.Join(",", a));
}
}
string output = String.Join(",", yourEnumerable);
String.Join Method (String, IEnumerable
Concatenates the members of a constructed IEnumerable collection of type String, using the specified separator between each member.
collection.Aggregate("", (str, obj) => str + obj.ToString() + ",");