I have two list objects, say List
class PDTO
{
public string Prop1{get; set;}
}
class UPDTO
{
public PDTO oPDTO {get; set;}
}
I have data in List
We can do the same like the below:
foreach (PDTO oPDTO1 in oListPDTO)
{
oListUPDTO.Add(new UPDTO() { oPDTO = oPDTO1 });
}
Is there any better way of doing this?
Thanks,
Mukesh KV

VulpesRank #55 · 29.2K reputationPosted Aug 1, 2011, 12:08 AM EDT
Zoran HorvatRank #792 · 2.9K reputationPosted Aug 1, 2011, 12:15 AM EDT
Zoran
mukesh kv15 reputationPosted Aug 1, 2011, 1:45 AM EDT
mukesh kv15 reputationPosted Aug 1, 2011, 1:48 AM EDT
VulpesRank #55 · 29.2K reputationPosted Aug 1, 2011, 3:46 AM EDT
However, using Select to do the conversions works fine and an explicit, rather than an implicit, conversion then suffices. So, it's still quite a neat approach.