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;
}
}
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;
}
}