Another answer mentioned AutoMapper
, but I would use it directly.
Mapper.CreateMap<Class1, Class2>()
.ForMember(dest => dest.member1,
opt => opt.MapFrom(src => Util.getThisAndThat(src.prop1)))
.ForMember(dest => dest.member2,
opt => opt.MapFrom(src => Util.doBunchOfStuff(src.prop2)));
public static List<T1> getList<T1>(List<T2> list2)
{
return Mapper.Map<List<T2>, List<T1>>(list2);
}