title: Constructor for different input types without code duplication in C#
body: <p>I have a problem with the mapping of my data class.
  It contains 164 properties that are getting filled with data received from a soap web service. Dont question the property count, this is an very old predefined .csv-like data scheme that i can not change.</p>
  <p>As far as i got it, everything works now, but since there are so many properties and I explicitly set every one of them (eg data.a1 = import.a1 OR data.a1 = export.a1) i have a big block of duplicated assignment code. Both web services deliver the same 164 fields plus some additional fields that differs for both classes. I think i only need to map the 164 identical fields and can ignore/discard the others.</p>
  <p>What would be the correct approach to solve this problem? I thought about using 'object' or something as data type in the constructor so that i can pass data from both services, but it does not seem to work like i imagined.</p>
  <p>Any advice would be greatly appreciated.</p>
  <pre><code>    /// &lt;summary&gt; Initializes a new instance of the &lt;see cref=&quot;DataTypeTest&quot; /&gt; class. &lt;/summary&gt;
      /// &lt;param name=&quot;incomingData&quot;&gt; Record from Export Webservice that will be mapped to the constructed instance. &lt;/param&gt;
      public Stddat(webExport incomingData)
      {
          // stddat fields
          this.Fields.SndRec = webExport.SndRec;
          this.Fields.PrtNum = webExport.PrtNum;
          this.Fields.MsgTyp = webExport.MsgTyp;
          .
          .
          .
      }   
      
      /// &lt;summary&gt; Initializes a new instance of the &lt;see cref=&quot;DataTypeTest&quot; /&gt; class. &lt;/summary&gt;
      /// &lt;param name=&quot;incomingData&quot;&gt; Record from Exchange Webservice that will be mapped to the constructed instance. &lt;/param&gt;
      public Stddat(webExchange incomingData)
      {
          // stddat fields
          this.Fields.SndRec = webExchange.SndRec;
          this.Fields.PrtNum = webExchange.PrtNum;
          this.Fields.MsgTyp = webExchange.MsgTyp;
          .
          .
          .
      }
  </code></pre>