I have a class that has an update method. In the update method, I'm checking whether its properties are really changed.
public class Person
{
public int Id { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public void UpdatePerson(Person person)
{
if (FirstName == person.FirstName && LastName == person.LastName) return;
ApplyChanges(person);
}
public void ApplyChanges(Person person)
{
//....
}
}
I need to ensure that ApplyChanges
method is not called when Person
properties are same.