class Goods { public int FID { get; set; } public string FName { get; set; } } List<Goods> goods = new List<Goods>(){ new Goods() { FID = 1, FName = "张" }, new Goods() { FID = 2, FName = "马" }, new Goods() { FID = 3, FName = "小" } }; //我想用linq得到 //string str="张,马,小";
string.Join(",", goods.Select(g => g.FName));
string.join(",",goods)
var bb = goods.Select(g => g.FName);
string nn = "";
foreach (string a in bb)
{
nn += a + ",";
}
nn = nn.Substring(0, nn.Length - 1);
3楼的很好。