internal class DistinctComparer : IEqualityComparer<sy_phone> { public bool Equals(sy_phone x, sy_phone y) { return x.Phone == y.Phone; } public int GetHashCode(sy_phone obj) { return $"{obj.Phone}".GetHashCode(); } }
调用
listPhone.Distinct(new DistinctComparer()).ToList()