用到三个API:
交集:Intersect
并集:Union
差集:Except
var A=new List(){1,2,3,4,5,6};var B=new List(){3,4,5,6,7,8,9};var C=A.Intersect(B);//交集{3,4,5,6}var D=A.Union(B);//并集{1,2,3,4,5,6,7,8,9}var E=A.Except(B);//差集{1,2}var F=B.Except(A);//差集{7,8,9}
京公网安备 11010502049817号