When overriding the Equals() method, make sure the passed-in object is not null and can be cast to the type you are comparing . When overriding Equals(), you also need to override GetHashCode(), otherwise you get a compiler warning.
When overriding the Equals() method, make sure the passed-in object is not null and can be cast to the type you are comparing . When overriding Equals(), you also need to override GetHashCode(), otherwise you get a compiler warning.