title: Mapping members with similar names Using Automapper
body: <p>In a remote db, which I can only read, there are 24 columns in a row for each hour of day. Their names go as P1, P2, ..., P24.</p>
  
  <p>I must copy the values to my own db, which I named column names as H1, H2, ..., H24.</p>
  
  <p>How can I use auto mapper to map remote columns to locals ?</p>
  
  <pre><code>CreateMap&lt;Data.Context.SomeTableFromRemoteDb, Data.Entity.MyTableInLocaldb&gt;()
                  .ForMember(x =&gt; x.H1, y =&gt; y.MapFrom(z =&gt; z.P1))
                  .ForMember(x =&gt; x.H2, y =&gt; y.MapFrom(z =&gt; z.P2))
                  .ForMember(x =&gt; x.H3, y =&gt; y.MapFrom(z =&gt; z.P3))
                  .ForMember(x =&gt; x.H4, y =&gt; y.MapFrom(z =&gt; z.P4))
                  .ForMember(x =&gt; x.H5, y =&gt; y.MapFrom(z =&gt; z.P5))
                  .ForMember(x =&gt; x.H6, y =&gt; y.MapFrom(z =&gt; z.P6))
                  .ForMember(x =&gt; x.H7, y =&gt; y.MapFrom(z =&gt; z.P7))
                  .ForMember(x =&gt; x.H8, y =&gt; y.MapFrom(z =&gt; z.P8))
                  .ForMember(x =&gt; x.H9, y =&gt; y.MapFrom(z =&gt; z.P9))
                  .ForMember(x =&gt; x.H10, y =&gt; y.MapFrom(z =&gt; z.P10))
                   .ForMember(x =&gt; x.H11, y =&gt; y.MapFrom(z =&gt; z.P11))
                   .ForMember(x =&gt; x.H12, y =&gt; y.MapFrom(z =&gt; z.P12))
                   .ForMember(x =&gt; x.H13, y =&gt; y.MapFrom(z =&gt; z.P13))
                   .ForMember(x =&gt; x.H14, y =&gt; y.MapFrom(z =&gt; z.P14))
                   .ForMember(x =&gt; x.H15, y =&gt; y.MapFrom(z =&gt; z.P15))
                   .ForMember(x =&gt; x.H16, y =&gt; y.MapFrom(z =&gt; z.P16))
                   .ForMember(x =&gt; x.H17, y =&gt; y.MapFrom(z =&gt; z.P17))
                   .ForMember(x =&gt; x.H18, y =&gt; y.MapFrom(z =&gt; z.P18))
                   .ForMember(x =&gt; x.H19, y =&gt; y.MapFrom(z =&gt; z.P19))
                   .ForMember(x =&gt; x.H20, y =&gt; y.MapFrom(z =&gt; z.P20))
                   .ForMember(x =&gt; x.H21, y =&gt; y.MapFrom(z =&gt; z.P21))
                   .ForMember(x =&gt; x.H22, y =&gt; y.MapFrom(z =&gt; z.P22))
                   .ForMember(x =&gt; x.H23, y =&gt; y.MapFrom(z =&gt; z.P23))
                   .ForMember(x =&gt; x.H24, y =&gt; y.MapFrom(z =&gt; z.P24));
  </code></pre>
  
  <p>This is the current code. What I ask is can we convert it to something like this:</p>
  
  <pre><code>CreateMap&lt;Data.Context.SomeTableFromRemoteDb, Data.Entity.MyTableInLocaldb&gt;()
                      .ForMember(x =&gt; x.ReplaceMemberName(o=&gt; o, "H", "P"), y =&gt; y.MapFrom(z =&gt; z.P1))
  </code></pre>
  
  <p>Automapper has a function with name <code>replacemembername</code> but It does not seem to be what I'm seeking.</p>