日期:2014-05-17  浏览次数:20957 次

如何得到两个LIST中不相同的数据
比如list<a> 中有这样的几个数  1 2 3 4 5 
list<b> 中有这样的几个数      1 2 3 4 5 6 7
 怎样才能去除  6 和 7 
  在对比 两个List之后
.net list c#

------解决方案--------------------
 IList<int> aa = new List<int> { 1, 2, 3, 4, 5 };
            IList<int> bb = new List<int> { 1, 2, 3, 4, 5, 6, 7 };
            IList<int> cc = bb.Except(aa).ToList<int>();

------解决方案--------------------
a.Except(b).Union(b.Except(a))
------解决方案--------------------
本帖最后由 caozhy 于 2013-07-06 22:14:08 编辑
or 
a.Union(b).Except(a.Intersect(b))