对比两个list , 将不同的记录找出来
实体类: Sort, 属性: SortId(int), Name(string), OrderBy (int)
List<Sort> newList = xxx;
List<Sort> oldList = xxx;
如何将 两个List中SortId相同, 而OrderBy不同的记录找出来?
请各位大侠支招.
------解决方案--------------------var query = oldlist.SelectMany(x => newlist.Where(y => y.SortId == x.SortId && y.OrderBy != x.OrderBy));
------解决方案--------------------List<Sort> newList ;
List<Sort> oldList ;
var query= from x in newList
join y in oldList
on x.SortId equals y.SortId
where x.OrderBy != y.OrderBy
select x;