Hi All,
Just been re-reading Applied MS .Net Framework Programming (been about
2 years since I last read it) and came across the chapter on Equals,
==, and GetHashCode. It dawned on me that after 2 years of c# .net
programming I have never overridden any of these methods.
But why would I? For example, I have a simple class:
class MC
{
int i;
MC (int i)
{
this.i = i;
}
}
If I then implemented:
MC c1, c2;
c1 = new MC (2);
c2 = new MC (2);
bool theSame = (c1 == c2); // Would this return false because
different instances?
bool theSame2 = (c1.Equals (c2)); // Is this the same as the above?