Overriding GetHashCode , Equals methods.
While browsing through questions of C# , I came across this question If A.equals(B) is true then A.getHashcode & B.getHashCode must always return same hash code I found this interesting example in the site --https://vkreynin.wordpress.com/2008/07/05/explaining-gethashcode-method/ Which explains this questions . A hash code is a numeric value that is used to insert and identify an object in a hash-based collection such as the Dictionary<TKey, TValue> class, the Hashtable class, or a type derived from the DictionaryBase class. The GetHashCode method provides this hash code for algorithms that need quick checks of object equality. Two objects that are equal return hash codes that are equal. However, the reverse is not true: equal hash codes do not imply object equality, because different (unequal) objects can have identical hash codes. using System; public class Point { private readonly int _x; ...