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);
}
Top comments (0)