重写Distinct

添加类并继承`IEqualityComparer`,重写方法
public class DistinctComparer : IEqualityComparer<ActionInfo>
{
public bool Equals(ActionInfo x, ActionInfo y)
{
return x.ID == y.ID;
} public int GetHashCode(ActionInfo obj)
{
return obj.ID.GetHashCode();
}
}

调用

 user_actions.Distinct<ActionInfo>(new DistinctComparer());
上一篇:Asp.net EasyUI中的combogrid实现分页功能


下一篇:jsp基础语言-jsp注释