IEqualityComparer (https://msdn.microsoft.com/en-us/library/ms132151(v=vs.110).aspx) is interface which defines methods for object comparation. IEqualityComparer can be used for comparation of Dictionary Collections.
Equals is methid which compares 2 object values. If they are equal it will return true, else it will return false.
GetHashCode(https://msdn.microsoft.com/en-us/library/system.object.gethashcode(v=vs.110).aspx) is method which return interger hash code of particular object. This is basicaly object memory address. If hash values of 2 object are the same, then comparer will return value true. Hash code should be unique until end of object lifetime. This is reason why values for which we need hash values need to be Immutable.
public class CustomerComparer : IEqualityComparer<Customer>
public bool Equals(Customer customer1, Customer customer2)
return customer1.Id == customer2.Id;
public int GetHashCode(Customer customer)