internal void CopyNonNullValuesFromsObject(sObject i_Src) { if (i_Src == null) { return; } // Check myself and i_src are same type Type myDerivedType = GetType(); if (myDerivedType != i_Src.GetType()) { return; } //TODO: Check ids? BindingFlags propertiesSearchFlags = BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public; IEnumerable <PropertyInfo> nonEmptyProperties = myDerivedType.GetProperties(propertiesSearchFlags); foreach (PropertyInfo propertyToCopy in nonEmptyProperties) { object valueToCopy = propertyToCopy.GetValue(i_Src); if (DeserializationUtils.ShouldCopyPropertyValue(propertyToCopy, valueToCopy)) { propertyToCopy.SetValue(this, valueToCopy); } } }