Coming from a C++ background, I am finding cloning of objects in C# a little hard to get used to. To clear up some of my confusion, I am looking for an elegant way to clone an object of a base type to a derived type.
To illustrate:
public class Base
{
public string Member1;
public int Member2;
public float Member3;
public bool Member4;
}
public class Derived : Base
{
public List<Base> Children;
}
Base base = new Base();
And with that I want to create an instance of "Derived" whilst doing a memberwise copy of the Base object - preferably without assigning them manually.
Note: Maybe this would be more suited to a value type?