标签:字符 name 结果 int array tostring key nbsp group
Q:
id name
1 t
2 t
3 c
期望结果
{"1,2","t"}
{"3","c"}
方法如下:
var result = from item in tbl
group item by item.name into g
let ids = g.Select(b => b.id.ToString()).ToArray()
select new { id = String.Join(",", ids), name = g.Key };
标签:字符 name 结果 int array tostring key nbsp group
原文地址:https://www.cnblogs.com/wlming/p/14056126.html