I have a very simply question regarding IEquatable. Given the following basic classes:
public class Person
{
public string FirstName { get; set; }
public string LastName { get; set; }
public SalaryInformation AnnualSalaryInformation { get; set; }
}
public class SalaryInformation
{
public string TaxCode { get; set; }
public string SalaryBand { get; set; }
public BankInformation AccountInfo { get; set; }
}
public class BankInformation
{
public string SortCode { get; set; }
public string AccountNumber { get; set; }
}
If I wanted to compare to Person objects for equality how would I go about it? If I implement the IEquatable interface on the the Person class, will it automatically cascade down to any objects within that class or do I have to explicitly implement the interface on all the classes?
If I do have to implement the interface on all the classes, are there any particular 'gotchas' I should look out for, when comparing an instance of Person to another instance of Person?