title: I need to implement C# deep copy constructors with inheritance. What patterns are there to choose from?
body: <p>I wish to implement a deepcopy of my classes hierarchy in C# </p>
  
  <pre><code>public Class ParentObj : ICloneable
  {
      protected int   myA;
      public virtual Object Clone ()
          {
               ParentObj newObj = new ParentObj();
               newObj.myA = theObj.MyA;
               return newObj;
          }
  }
  
  public Class ChildObj : ParentObj
  {
      protected int   myB;
      public override Object Clone ( )
          {
               Parent newObj = this.base.Clone();
               newObj.myB = theObj.MyB;
  
               return newObj;
          }
  }
  </code></pre>
  
  <p>This will not work as when Cloning  the Child only a parent is new-ed. In my code some classes have large hierarchies.</p>
  
  <p>What is the recommended way of doing this? Cloning everything at each level without calling the base class seems wrong? There must be some neat solutions to this problem, what are they?</p>
  
  <p><strong><em>Can I thank everyone for their answers. It was really interesting to see some of the approaches. I think it would be good if someone gave an example of a reflection answer for completeness. +1 awaiting!</em></strong> </p>