Understood the concept of translate. Used it in converting a DataModel Type to DTO type for presentation layer like this and worked fine.
objTypeB = objTypeA.TranslateTo<clsTypeB>();
Discrepancy between TypeA and TypeB was just the datatype of few properties and I converted them in the Property Set
method.
But in the above implementation if the source is List<TypeA>
, I have loop through each to translate to TypeB
and add it another List<TypeB>
instance. Is it possible to do something like this instead:
Assume resultListA
is a List<clsTypeA>
var resultListB = resultListA.TranslateTo<List<clsTypeB>>();
I tried and does not seem to convert. I get a empty resultListB
. Any easy approach to this??