调用:
var dataThis = data.Where(es=>es.IndentyTime== identyDateList[0]).ToList();
var dic = dataThis.Distinct( new repDic()).ToList();var repList = "";
foreach (var item in dic)
{
if (repList == "") repList = item.RepID.ToString();
else repList += ","+item.RepID.ToString();
}
去重方法:
public class repDic : IEqualityComparer<Ta_GoodsValue>
{
public bool Equals(Ta_GoodsValue x,Ta_GoodsValue y)
{
return x.RepID == y.RepID;
}
public int GetHashCode(Ta_GoodsValue x)
{
return x.ToString().GetHashCode();
}
}