Ejemplo n.º 1
0
        private static void CopyValues <TDest>(List <string> FieldList, object Source, object Destination)
        {
            foreach (var propName in ReflectionTool <TSource> .getPropertyNames())
            {
                if ((FieldList == null || FieldList.Contains(propName))
                    && //check if destination object has the same propetyName
                    ReflectionTool <TDest> .ContainsPropertyName(propName))
                {
                    var value = ReflectionTool <TSource> .GetPropertyValue(Source, propName, GetDefaultValue(Source.GetType()));

                    ReflectionTool <TDest> .SetPropertyValue(Destination, propName, value);
                }
            }
        }