Add db output to list within list

Mar 8 2013 6:03 AM
Hi,

My db output contains of n rows, and each row contains five colomns like this:
content1content2content3content4content5

My contract I want to add this output too look like this:
Portfolio(content1, content2, Subportfolio[])
Subportfolio(content3, content4,content5)

I read first row from db output, and add data to Portfolio and Subportfolio.

For the next db row I must to check if both content1 and content2 are same as in first db row. If this is true, I would like to add a second instance of SubPortolio to the first Portfolio.

I have come so far as to check if second row equal frist row. But how to proceed to add a second SubPortfolio inside the first Portfolio?

Types:
IEnumerable<Portfolio>
IEnumerable<SubPortfolio>


Answers (1)