I am using Entity Framework 5. In my C# code I want to compare if two objects are equal. If there are not then I want to issue an update.
I have been told I need to override the .Equals method and then also the gethascode method. My classes look like this:
public class Students {
public int PersonId { get; set; }
public string Name { get; set; }
public int Age {get; set;}
}
Can some explain why I need to override .Equals and .GetHashCode. Also can someone give me an example. In particular I am not sure about the hashcode. Note that my PersonId is a unique number for this class.