123456789101112131415161718192021222324252627282930313233343536 |
- namespace Common.system
- {
-
-
-
-
-
- public class DataConvertCommon
- {
-
-
-
-
-
-
-
-
-
- public static TChild ParentClassCopy<TParent, TChild>(TParent parent) where TChild : TParent, new()
- {
- TChild child = new TChild();
- System.Type ParentType = typeof(TParent);
- System.Reflection.PropertyInfo[] Properties = ParentType.GetProperties();
- foreach (System.Reflection.PropertyInfo Propertie in Properties)
- {
-
- if (Propertie.CanRead && Propertie.CanWrite)
- {
-
- Propertie.SetValue(child, Propertie.GetValue(parent, null), null);
- }
- }
- return child;
- }
- }
- }
|