title: Mapping two classes in c#
body: <p>I have two classes</p>
  
  <pre><code>public class foo1
  {
    public int id;
    public string image_link;
    public string sale_price;
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>public class foo2
  {
   public int Id;
   public string ImageLink;
   public string SalePrice
  }
  </code></pre>
  
  <p>The property values differ only by underscore and cases. I need to map these two classes. </p>
  
  <p>For now I am trying something like this and its working:</p>
  
  <pre><code>//var b = object of foo2
  var a = new foo1{
   a.id = b.Id,
   a.image_link = b.ImageLink,
   a.sale_price = b.SalePrice
  }
  </code></pre>
  
  <p>I heard of AutoMapper, but I din't have clear idea of how i am going to use that or where is the option of ignoring cases or underscores in it. or is there any better solution to it?</p>