Let's assume that we have a Model
with several properties on it and we want to create a decorator class of this model to enhance it with some extra properties. Now we want to create a new instance of the DecoratedModel
populated with all the property values of Model
, perhaps using a constructor with Model
as a parameter:
public class DecoratedModel : Model
{
public DecoratedModel(Model baseModel)
{
// Populate decorated model generically from baseModel
}
}
What would be the most generic, concise way to populate the DecoratedModel
from the Model
?