public static void Copy <TSource, TTarget>(TSource source, TTarget target, List <string> validFields) where TSource : class where TTarget : class { PropertyCopier <TSource, TTarget> .Copy(source, target, validFields); }
/// <summary> /// Copies all public, readable properties from the source object to the /// target. The target type does not have to have a parameterless constructor, /// as no new instance needs to be created. /// </summary> /// <remarks>Only the properties of the source and target types themselves /// are taken into account, regardless of the actual types of the arguments.</remarks> /// <typeparam name="TSource">Type of the source</typeparam> /// <typeparam name="TTarget">Type of the target</typeparam> /// <param name="source">Source to copy properties from</param> /// <param name="target">Target to copy properties to</param> public static void Copy <TSource, TTarget>(TSource source, TTarget target) where TSource : class where TTarget : class { PropertyCopier <TSource, TTarget> .Copy(source, target); }