C# 集合根据属性去重筛选

1.单个属性去重筛选

//去重筛选
var ChgDtlVoList = datas.Where((x, i) => datas.FindIndex(z => z.ChgId == x.ChgId ) == i).ToList()

2.多个属性筛选去重(三个属性)

//去重筛选
 var ChgDtlVoList = datas.Where((x, i) => datas.FindIndex(z => z.ChgId == x.ChgId ) == i).ToList().Where((x, i) => datas.FindIndex(z => z.OdStd == x.OdStd) == i).ToList().Where((x, i) => datas.FindIndex(z => z.BatNo == x.BatNo) == i).ToList();

 

C# 集合根据属性去重筛选

上一篇:2018-8-10-win10-uwp-进度条-Marquez-


下一篇:Spring MVC 的json问题(406 Not Acceptable)