title: AutoMapper include all properties of a custom List<T>
body: <pre><code>class SomeObject
  {
     public string name {get;set;}
  }
  
  class CustomCollection : List&lt;SomeObject&gt;
  {
     public int x {get;set;}
     public string z {get;set;}
  }
  
  class A
  {
     public CustomCollection collection { get ; set; }
  }
  
  class B
  {
     public CustomCollection collection { get ; set; }
  }
  
  
  // Creating mapping   
  Mapper.CreateMap&lt;A, B&gt;();
  </code></pre>
  
  <p>When I Map A to B, all properties get mapped correctly except X and Z in CustomCollection. </p>
  
  <p>CustomCollection correctly gets the List of SomeObject initialized and SomeObject.Name is also mapped correctly. </p>
  
  <p>Only the custom properties X, Z that I've declared in the collection do not get mapped.</p>
  
  <p>What am I doing wrong?</p>
  
  <p>Only way I've found is to do an after mapping like below, but then it kinda defeats the purpose of using automapper and it breaks everytime I add a new property to CustomCollection.</p>
  
  <pre><code> Mapper.CreateMap&lt;A, B&gt;().AfterMap((source, destination) =&gt; { 
       source.x = destination.x; 
       source.z = destination.z ;
  });
  </code></pre>