有些数据结构用GetHashCode来做快速判断,但对‘比较’本身来说,GetHashCode并不是必要的。这些数据结构有Dictionary,HashSet等:class C
{
    public static int i = 0;
    public override int GetHashCode() { return i++; }
}static void Main(string[] args)
{
    C obj1 = new C();
    HashSet<C> hashSet = new HashSet<C>(new C[] { obj1, obj1 });
    int count = hashSet.Count; // 2 (如果把GetHashCode override去掉,就是1)
}