/// <summary> /// Craete a new Object and Copy all Properties to the output Instance /// </summary> /// <typeparam name="TInput"></typeparam> /// <typeparam name="TOutput"></typeparam> /// <param name="input"></param> /// <returns></returns> public static TOutput CreateCopy <TInput, TOutput>(TInput input) where TOutput : new() { TOutput op = new TOutput(); PropMapper <TInput, TOutput> .CopyTo(input, op); return(op); }
/// <summary> /// returns a Copy for each Input Instanz /// All public Properties get copied /// </summary> /// <typeparam name="TInput"></typeparam> /// <typeparam name="TOutput"></typeparam> /// <param name="inputArr"></param> /// <returns></returns> public static IEnumerable <TOutput> CreateCopy <TInput, TOutput>(IEnumerable <TInput> inputArr) where TOutput : new() { foreach (TInput input in inputArr) { TOutput op = new TOutput(); PropMapper <TInput, TOutput> .CopyTo(input, op); yield return(op); } }