//原数据
List<T_Model> tmpListAll=new List<T_Model>();
//去除集合中重复数据后
List<T_Model> tmpList = tmpListAll.Distinct(new AutoFilterParmsCompare()).ToList();
/// <summary>
/// 比较器
/// </summary>
public class AutoFilterParmsCompare : EqualityComparer<T_Model>
{
public override bool Equals(T_Model x,T_Model y)
{
return x.InvoiceNo == y.InvoiceNo && x.InvoiceDate == y.InvoiceDate;
}
public override int GetHashCode(T_Model obj)
{
return obj.InvoiceNo.GetHashCode();
}
}
public class T_Model{
public string InvoiceNo{get;set;}
public string InvoiceDate {get;set;}
}