/// <summary> /// R代表目标实体 T代表数据源实体 /// </summary> public static R MappingObject<R, T>(T model) { R result = Activator.CreateInstance<R>(); foreach (PropertyInfo info in typeof(R).GetProperties()) { PropertyInfo pro = typeof(T).GetProperty(info.Name); if (pro != null) info.SetValue(result, pro.GetValue(model)); } return result; }