Copy list object into object of another list object
Hi all,
I have two list objects, say List<UPDTO> and List<PDTO>
class PDTO
{
public string Prop1{get; set;}
}
class UPDTO
{
public PDTO oPDTO {get; set;}
}
I have data in List<PDTO>. And I want this to get copied to the object (PDTO) that I have in List<UPDTO>. Could you please let me know the solution?
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