Answer: Apply properties values from one object to another of the same type automatically?

arteny profile image Alexey ・1 min read

Here's a short and sweet version, since you said both of your objects are of the same type:

foreach (PropertyInfo property in typeof(YourType).GetProperties().Where(p => p.CanWrite))
    property.SetValue(targetObject, property.GetValue(sourceObject, null), null);


markdown guide