I've got a class public class foubar : fou
fou has its properties and so does foubar I've created an instance of foubar and set values to all the properties including the base classes'. Now I need an instance of fou that has the property values that are in foubar. True, I could create a new instance of fou and write code that would populate this new instance from a foubar instance but that means I have to change to code every time the base class properties change.
I'd like something that would work like this, where FB is an instance of foubar
fou test = (fou) FB;
This "works" in C#, but test is really type foubar. I need only fou, nothing else,
I want a way to dynamically return an instance of a base class populated from the data/instance of the derived class.
Ideas?