Linq Distinct List 去重复
//调用 return producePlantlst.Distinct(new item_collection_DistinctBy_item1()).ToList(); //方法 public class item_collection_DistinctBy_item1 : IEqualityComparer<FMDS_ProducePlantInfo> { public bool Equals(FMDS_ProducePlantInfo x, FMDS_ProducePlantInfo y) { if (x.TaskAreaName == y.TaskAreaName && x.FarmPlotName == y.FarmPlotName && x.PlantYear == y.PlantYear && x.FarmerName == y.FarmerName && x.FarmProductClassName == y.FarmProductClassName) { return true; } else { return false; } } public int GetHashCode(FMDS_ProducePlantInfo obj) { return 0; } }