A集合中 1,2,3
B集合中 2,3,4
需求是的 2,3,4的结果
但是我要知道 被删除的是1
以及 4是新增加的
如何处理
------解决方案--------------------
- C# code
List<int> listA = new List<int> { 1, 2, 3 }; List<int> listB = new List<int> { 2, 3, 4 }; var linqA = listA.Intersect(listB); foreach (var l in linqA) Console.WriteLine("交集:" + l); var linqB = listB.Except(listA); foreach (var l in linqB) Console.WriteLine("差集:"+l); Console.ReadLine(); /* 交集:2 交集:3 差集:4 */
------解决方案--------------------