Link to home
Start Free TrialLog in
Avatar of oak29
oak29

asked on

Nested Generic List

I'm trying to create a nested  generic list.  My first List consists of a list of datarows.  I would like the first list to be the parent list and then also give this list a child list of datarows but I'm unsure of the syntax or if this is even possible. any ideas?
Avatar of Naman Goel
Naman Goel
Flag of India image

It seems you want List of

 Dim lstDataRows As List(Of List(Of DataRow))

Open in new window



And here I am initializing it:
        lstDataRows = New List(Of List(Of DataRow))

Open in new window


then assignment of datarow to first item of lstDataRows list

 
       lstDataRows.Add(New List(Of DataRow))

Open in new window

Avatar of oak29
oak29

ASKER

I guess I'm not sure how this creates a parent list of datarows with a list of children datarows that are assigned to parent.  Maybe I'm missunderstanding.

Could you show me the syntax for adding the parent row and also adding the child rows in a different list beneath parent.  There can be multiple parent rows.  This is why I want a seperate list for them.
I think I misunderstood your question itself. Can you please explain your question in detail.

for me nested list means List of List
Avatar of oak29

ASKER

I'm trying to find a way to manage two datatables in memory that relate to each other.  The datarows of the parent table are created by a user button.  I then need to create at the same time multiple datarows that are the children of the parent datarow.

 There can be multiple datarows in the parent table that have their own children rows.  I thought that I could use lists to accomplish this linking.  Is there a better solution for what I'm trying to accomplish?
ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial