title: C# - Automapper - Map element with condition
body: <p>I have two classes:</p>
  
  <pre><code>public class Customer
  {
      public string FirstName { get; set;  }
  
      public string LastName { get; set; }
  
      public int Quantity { get; set; }
  };
  
  public class Customer_
  {
      public string FirstNam { get; set; }
  
      public string LastNam { get; set; }
  
      public int Quantity { get; set; }
  }
  </code></pre>
  
  <p>And a mapping between the two with Automapper library :</p>
  
  <pre><code>Customer[] data =  new Customer[3];
  
  var config = new MapperConfiguration(cfg =&gt;
  {
      cfg.CreateMap&lt;Customer, Customer_&gt;()
     .ForMember(dest =&gt; dest.FirstNam, opt =&gt; opt.MapFrom(src =&gt; src.FirstName))
     .ForMember(dest =&gt; dest.LastNam, opt =&gt; opt.MapFrom(src =&gt; src.LastName));
  
  });
  
  IMapper mapper = config.CreateMapper();
  Customer_[] desti = mapper.Map&lt;Customer[], Customer_[]&gt;(data);
  </code></pre>
  
  <p>It works, but how to map only the elements of my array data that meet a condition ? For example : map only the element who have a <code>Quantity &gt; x</code> </p>
  
  <p>Thank's</p>