Convert Base Model To Sub View Model
<p>I have a model named DriverStaistic and a view model which inherits from it
the view model doesn't contain any extra properties it's just an empty inheritance of DriverStaistic, the reason I'm doing that is that I receive the model objects from an external library and I want to keep coupling to the minimum.
since the base and the sub class contains the same properties I was wondering if we there's a neat way to convert between them other than using the lambda expression which requires me to modify it every time I add or omit a property</p>

<p>I have come out with this solution using reflection but I believe it will present performance issues in the future.
can anyone come with a better suggestion?</p>

<pre><code>public static void FromDriverStatistic(this DriverStatisticsVm viewModel, object model)
{
    bool isDriverStatistic = model is DriverStatistic;

    if(!isDriverStatistic)
        throw  new InvalidCastException();

    var modelProperties = model.GetType().GetProperties();
    foreach (var property in modelProperties)
    {
        property.SetValue(viewModel, property.GetValue(model));
    }
}
</code></pre>