List<A> aList = new List<A>() 我要取出 也就是Phone 相同的 ,用Linq 。。。该怎么做呀,虚心求教。。我已经研究了好长时间了。。。 |
|
from l in list group l by l.Phone into g where g.Count()>0 select g; |
|
20分 |
from l in list group l by l.Phone into g where g.Count()>1 select g; 上面写错了,要改成>1 |
20分 |
var result = from r in lst group r by r.Phone into g where g.Count() > 1 select g; //遍历分组结果集 foreach (var item in result) { foreach (A u in item) { Console.WriteLine(u.ID); } } |
2楼3楼是一个方法,也是正确的
|
|
太感谢你们了。。谢谢。。我去试试
|