title: Automapper. How to map custom type property of inner class (source) to string and string array?
body: <p>I want to map source inner classes to string and in other case string array but in both cases they are mapped to null. I want MapNoteFromInnerSourceEntity1 to hold a value of InnerSourceEntity1 Id property and MapValueFromInnerSourceEntity2 to hold values of InnerSourceEntity2 value properties. So far automapper is quite difficult for me to understand.</p>
  <p>Code:</p>
  <pre><code>    internal class Program
  {
      public class InnerSourceEntity1
      {
          public string Id { get; set; }
          public string Note { get; set; }
      }
  
      public class InnerSourceEntity2
      {
          public string Id { get; set; }
          public string Value { get; set; }
      }
  
      public class SourceEntity
      {
          public InnerSourceEntity1 A { get; set; }
          public IList&lt;InnerSourceEntity2&gt; B { get; set; }
      }
  
      public class DestinationEntity
      {
          public string MapNoteFromInnerSourceEntity1 { get; set; }
          public string[] MapValueFromInnerSourceEntity2 { get; set; }
      }
  
      static void Main()
      {
          var source = new SourceEntity
          {
              A = new InnerSourceEntity1 { Note = &quot;Note&quot;, Id = &quot;Id&quot;},
              B = new List&lt;InnerSourceEntity2&gt; { new InnerSourceEntity2 { Id = &quot;Id&quot;, Value = &quot;Value&quot; }, new InnerSourceEntity2 { Id = &quot;Id&quot;, Value = &quot;Value&quot; } }
          };
  
          var config = new MapperConfiguration(cfg =&gt; {
              cfg.CreateMap&lt;SourceEntity, DestinationEntity&gt;();
              cfg.CreateMap&lt;InnerSourceEntity1, string&gt;().ConvertUsing(s =&gt; s.Note);
              cfg.CreateMap&lt;IList&lt;InnerSourceEntity2&gt;, string[]&gt;();
          });
  
          var mapper = new Mapper(config);
          DestinationEntity destination = mapper.Map&lt;SourceEntity, DestinationEntity&gt;(source);
  
          Console.ReadLine();
      }
  }
  </code></pre>