title: Unable to cast 2 objects although they share same interface
body: <p>I would like to map 2 objects but I don't want to rely on 3rd party tools - the reason is to help me get a better understanding of what those 3rd party tools may do.</p>
  
  <p>I have an interface, which has <code>string</code> <code>Foo</code> and <code>bool</code> <code>Bar</code> </p>
  
  <pre><code>public interface ITest
  {
      string Foo { get; set; }
      bool Bar { get; set; }
  }
  </code></pre>
  
  <p>My first class, called <code>A</code> implements ITest</p>
  
  <pre><code>public class A : ITest
  {
      public string Foo { get; set; }
      public bool Bar { get; set; }
  }
  </code></pre>
  
  <p>And finally, Class <code>B</code> also implements ITest but has an additional property</p>
  
  <pre><code>public class B : ITest
  {
      public string Foo { get; set; }
      public bool Bar { get; set; }
      public int Other { get; set; }
  }
  </code></pre>
  
  <p>Since both classes share a common interface, how can I cast one to the other? </p>
  
  <pre><code>var a = new A();
  var b = new B();
  a= b as A; //does not work but this would be ideal
  </code></pre>
  
  <p>I don't want to Map by explicitly stating the names of the properties. </p>
  
  <p>As such, having (where the B constructor maps) is also not ideal</p>
  
  <pre><code>var a = new A();
  var b = new B(a); //not desired
  </code></pre>
  
  <p>Is this possible? It would mean that only the properties that were defined in the interface would be copied across. </p>
  
  <p>Answers like <a href="https://stackoverflow.com/questions/37484065/c-sharp-map-two-complex-objects">C# map two complex objects</a> are not ideal as I have to explicitly state the properties.</p>