C# List去重的比较器

public class user_collection_DistinctBy_userId : IEqualityComparer<User>
{

public bool Equals(User x, User y)
{
if (x.UserId == y.UserId)
{
return true;
}
else
{
return false;
}
}

public int GetHashCode(User obj)
{
return 0;
}
}
posted @ 2014-10-24 10:20  大木水可  阅读(606)  评论(0编辑  收藏  举报