14
当覆盖Equals方法时,覆盖GetHashCode为什么很重要?
鉴于以下课程 public class Foo { public int FooId { get; set; } public string FooName { get; set; } public override bool Equals(object obj) { Foo fooItem = obj as Foo; if (fooItem == null) { return false; } return fooItem.FooId == this.FooId; } public override int GetHashCode() { // …
1444
c#
overriding
hashcode