I have a base class with a lot of data members and I wanted to create a constructor in derived class, that will take a base class as a parameter and assign all data members values from the parameter:
class Derived: Base
{
Derived(Base baseClass)
{ //Assign all data
}
}
where Jeffrey Tan from Microsoft Support suggested :
public extendeddatagrid(MyDataGrid obj)
{
this=obj.Clone() as DataGrid;
}
But .Net framework doesn’t have a facility to assign all members like MemberwiseClone Method does for copying.
So developer has to write code to assign all data members from passed object. It is quite annoying for big classes like I have.
Update: See my post Implement Copy constructor using Serialization or Reflecton