using System.Collections.Generic;
public static U CopyTo<T, U>(T original, U target) where U : class
Dictionary<string, object> keyValuePairs = new Dictionary<string, object>();
foreach (var prop in original.GetType().GetProperties())
var val = prop.GetValue(original, null);
keyValuePairs.Add(prop.Name, val);
if (target != null && keyValuePairs.Count > 0)
foreach (var prop in target.GetType().GetProperties())
prop.SetValue(target, keyValuePairs[prop.Name]);
public static void Main()