///
/// 对象深拷贝 -反射
///
public static class ClassOperation
{
public static T CopyByReflect
{
object retval = Activator.CreateInstance(obj.GetType());
PropertyInfo[] fields = obj.GetType().GetProperties();
foreach (var field in fields)
{
try { field.SetValue(retval, field.GetValue(obj)); }
catch { }
}
return (T)retval;
}
}