摘要: 1:利用反射实现 public T DeepCopy<T>(T obj) { object retval= Activator.CreateInstance(typeof(T)); PropertyInfo[] pis = typeof(T).GetProperties(); foreach (PropertyInfo pi in pis) { try{pi.SetValue(retval, pi.GetValue(obj, null), null); } catch{ } } return (T)retval; }2:利用xml序列化和反序列化实现 public T DeepCo 阅读全文
posted @ 2012-05-07 00:19 大智若简 阅读(459) 评论(0) 推荐(0)