Seems logical, but might be a bit inefficient. I take it the object in question is just a simple poco.
You could use reflection to do this too.
This code will copy the properties of an object and return an instance of the new copy
public TTranslateTo TranslateTo<TTranslateTo>()
{
var target = Activator.CreateInstance<TTranslateTo>();
foreach (var p1 in GetObjectTypeProperties)
{
var p2 =
target.GetType()
.GetProperties()
.FirstOrDefault(p => string.Equals(p.Name, p1.Name, StringComparison.CurrentCultureIgnoreCase) && p.PropertyType == p1.PropertyType);
p2?.SetValue(target, p1.GetValue(this));
}
return target;
}
private IEnumerable<PropertyInfo> GetObjectTypeProperties => GetType()
.GetProperties();
You could include this code in a base class giving you access to copy functions on all objects.