By using linq, this should work;
string delimeter = ",";
List<string> items = new List<string>() { "foo", "boo", "john", "doe" };
Console.WriteLine(items.Aggregate((i, j) => i + delimeter + j));
Updated according to comments:
class description:
public class Foo
{
public string Boo { get; set; }
}
usage:
class Program
{
static void Main(string[] args)
{
string delimeter = ",";
List<Foo> items = new List<Foo>() { new Foo { Boo = "ABC" }, new Foo { Boo = "DEF" },
new Foo { Boo = "GHI" }, new Foo { Boo = "JKL" } };
Console.WriteLine(items.Aggregate((i, j) => new Foo{Boo = (i.Boo + delimeter + j.Boo)}).Boo);
Console.ReadKey();
}
}
Updated-2:
and here is my best :)
items.Select(i => i.Boo).Aggregate((i, j) => i + delimeter + j)