构造父类:
T1 t1 = new T1 { C1= "1", C1= "2" };
构造子类:
T2 t2 = new T2 {C3="3" }
//遍历T1类的所有属性
foreach (PropertyInfo item in typeof(T1).GetProperties())
{
item.SetValue(t2 , item.GetValue(t1));
}
构造父类:
T1 t1 = new T1 { C1= "1", C1= "2" };
构造子类:
T2 t2 = new T2 {C3="3" }
//遍历T1类的所有属性
foreach (PropertyInfo item in typeof(T1).GetProperties())
{
item.SetValue(t2 , item.GetValue(t1));
}