public class Student { public string Id { get; set; } public string Name { get; set; } public override bool Equals(object obj) { Student e = obj as Student; return this.Id == e.Id && this.Name == e.Name; } public override int GetHashCode() { return this.Id.GetHashCode() * 100 + this.Name.GetHashCode(); } }
C# HashSet类(复杂)对象的去重
内容版权声明:除非注明,否则皆为本站原创文章。