List<T_CusBankCardInfoModel> blist = B_BLL.GetListByCusId(CusIds).Distinct(new ModelComparer()).ToList();
/// <summary>
/// 去"重复"时候的比较器(只要ProductNo相同,即认为是相同记录)
/// </summary>
class ModelComparer : IEqualityComparer<T_CusBankCardInfoModel>
{
public bool Equals(T_CusBankCardInfoModel p1, T_CusBankCardInfoModel p2)
{
if (p1 == null)
return p2 == null;
return p1.CusId == p2.CusId;
}
public int GetHashCode(T_CusBankCardInfoModel p)
{
if (p == null)
return 0;
return p.CusId.GetHashCode();
}
}
本文只为以后查看,防止忘掉所用,此文是网上的另一篇博客上的,由于原网址找不到了,在此说明一下