c# 反射
public void ObjectConvert(object oldobj, object obj)
{
PropertyInfo[] oldpropInfos = oldobj.GetType().GetProperties();
int fieldCount = oldpropInfos.Length;
for (int i = 0; i < fieldCount; i++)
{
PropertyInfo propInfo = obj.GetType().GetProperty(oldpropInfos[i].Name);
if (propInfo != null)
{
if (oldpropInfos.GetValue(i) != null)
{
if (propInfo.PropertyType.IsEnum)
{
propInfo.SetValue(obj, Enum.ToObject(propInfo.PropertyType, oldpropInfos.GetValue(i)), null);
}
else
{
propInfo.SetValue(obj, oldpropInfos.GetValue(i), null);
}
}
}
}
}
>
js改变网页字体的大小
人民网评:女大学生维权被关10个月 华硕申辩理由太苍白
