title: Compare two objects for properties with different values
body: <p>I need to create a generic method, which will take two objects (of same type), and return list of properties which have different values.
  As my requirement is bit different I don't think this as duplicate.</p>
  
  <pre><code>public class Person
  {
     public string Name {get;set;}
     public string Age {get;set;}
  }
  
  Person p1 = new Person{FirstName = "David", Age = 33}
  Person p2 = new Person{FirstName = "David", Age = 44}
  
  var changedProperties = GetChangedProperties(p1,p2);
  </code></pre>
  
  <p>The code explains the requirement:</p>
  
  <pre><code>public List&lt;string&gt; GetChangedProperties(object A, object B)
  {
      List&lt;string&gt; changedProperties = new List&lt;string&gt;();
     //Compare for changed values in properties 
     if(A.Age != B.Age)
     {
         //changedProperties.Add("Age");
     } 
     //Compare other properties
     ..
     ..
     return changedProperties;
  }
  </code></pre>
  
  <p>Should consider following:</p>
  
  <ol>
  <li>Generic - Should be able to compare any type of objects (with same class)</li>
  <li>Performance</li>
  <li>Simple</li>
  </ol>
  
  <p>Is there any libraries available out of the box there?</p>
  
  <p>Can I achieve this using <a href="http://automapper.org/" rel="noreferrer">AutoMapper</a>?</p>