通过使用LINQ,这应该可以工作。
string delimiter = ",";List<string> items = new List<string>() { "foo", "boo", "john", "doe" };Console.WriteLine(items.Aggregate((i, j) => i + delimiter + j));类说明:
public class Foo{ public string Boo { get; set; }}用法:
class Program{ static void Main(string[] args) { string delimiter = ","; 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 + delimiter + j.Boo)}).Boo); Console.ReadKey(); }}这是我最好的:)
items.Select(i => i.Boo).Aggregate((i, j) => i + delimiter + j)



