title: Using AutoMapper to map multiple collection properties of the same type
body: <p>I need to map to properties that are both collections of objects of the same type.</p>
  
  <p>For example:</p>
  
  <p>Destination:</p>
  
  <pre><code>public class MyNewObject
  {
      Collection TypeCollection1 { get; set; }
      Collection TypeCollection2 { get; set; }
  }
  
  public class MyType
  {
      string Field1 { get; set; }
      string Field2 { get; set; }
  }
  </code></pre>
  
  <p>Source:</p>
  
  <pre><code>public class MyLegacyObject
  {
      Collection LegacyCollection1 { get; set; }
      Collection LegacyCollection2 { get; set; }
  }
  
  public class MyLegacyType
  {
      string OldField1 { get; set; }
      string OldField2 { get; set; }
  }
  </code></pre>
  
  <p>For non-collections, I'm used to doing something like this:</p>
  
  <pre><code>Mapper.CreateMap()
      .ForMember(dest =&gt; dest.TypeCollection1, opt =&gt; opt.MapFrom( 
          src =&gt; new Collection 
          {
              // is there some kind of ForEach thing I can do???
              Field1 = src.OldField1,
              Field2 = src.OldField2
              ??? // this obviously doesn't work because these are the properties on MyType, not the collection
          }));
  </code></pre>