Пример #1
0
 private static void CopyScalarProperties(object fromObject, object toObject)
 {
     fromObject.GetType().GetProperties().
     Where(p => !CollectionUtils.IsCollection(p.PropertyType)).
     Where(p => p.CanRead && p.CanWrite).
     ForEach(p => p.SetValue(toObject, p.GetValue(fromObject, null), null));
 }
 private static void UpdateCollectionProperties(object fromObject, object toObject)
 {
     fromObject.GetType().GetProperties().Where(p => CollectionUtils.IsCollection(p.PropertyType)).ForEach(p => ShallowUpdateCollection(p.GetValue(fromObject, null), p.GetValue(toObject, null)));
 }