Convert ClassA into ClassB Extension
public class MyClassA { public long Id { get; set; } public int MyInt { get; set; } public long MyLong { get; set; } public string MyString { get; set; } public char MyChar { get; set; } public IList<int> MyIListInts { get; set; } } public class MyClassB { public int id { get; set; } public int MyInt { get; set; } public long MyLong { get; set; } public string MyString { get; set; } public char MyChar { get; set; } public IList<int> MyIListInts { get; set; } } public static class MyUtils { /// <summary> /// Converts <paramref name="entity"/> from <see cref="Tin"/> to <see cref="Tout"/> /// </summary> /// <typeparam name="Tout"></typeparam> /// <typeparam name="Tin"></typeparam> /// <param name="entity">the object to convert</param> /// <returns>The object converted</returns> public static Tout Convert<Tin, Tout>(this Tin entity) where Tin : class where Tout : class,new() { if (entity is Enum) { throw new NotImplementedException("No convertion for an enumeration"); } Tout output = new Tout(); Type fromType = entity.GetType(); Type toType = output.GetType(); PropertyInfo[] props = fromType.GetProperties(); foreach (PropertyInfo prop in props) { PropertyInfo outputProp = toType.GetProperty(prop.Name); if (outputProp != null && outputProp.CanWrite) { string propertyTypeFullName = prop.PropertyType.FullName; object value = prop.GetValue(entity, null); outputProp.SetValue(output, value, null); } } return output; } } public class MyMainClass { private void Test() { var a = new MyClassA { Id = 1L, MyChar = 'a', MyIListInts = Enumerable.Range(1, 9).ToList(), MyInt = 14, MyLong = 41, MyString = "Hello World!" }; MyClassB b = a.Convert<MyClassA, MyClassB>(); } }