Intersect 交集/ Except 差集

List<string> list1 = new List<string>();

List<string> list2 = new List<string>();

var intersectList = list1.Intersect(list2);

var exceptList = list1.Except(list2);

List<Person> pList1 = new List<Person>();

List<Person> pList2 = new List<Person>();

var pIntersectList = pList1.Intersect<Person>(pList2);

var pExceptList = pList1.Except<Person>(pList2);
文档更新时间: 2023-04-15 15:06   作者:admin