来自列表的C#不同列表
这个问题在这里已经有了答案:
您可以使用GroupBy
作为关键字的匿名类型:
occupancyResultList = occupancyResultList
.GroupBy(x => new { x.on_date, x.type_code, x.available })
.Select(g => g.First())
.ToList();
或DistinctBy
方法:
occupancyResultList = occupancyResultList
.DistinctBy(x => new { x.on_date, x.type_code, x.available })
.ToList();
链接地址: http://www.djcxy.com/p/51295.html