public class DcComparer : IEqualityComparer<Dc>
{
public bool Equals(Dc t1, Dc t2)
{
return (t1.IssuerCode== t2.IssuerCode&& t1.LACode== t2.LACode);
}
public int GetHashCode(Dc t)
{
return t.ToString().GetHashCode();
}
}
------解决方案--------------------
这个最简单
var query = list.GroupBy(x => new { /*在这里放入你视为重复的列,用逗号分割,比如*/ x.IssuerCode, x.LACode }).Select(x => x.First()).ToList(); ------解决方案-------------------- 参考Distinct和SequenceEqual