c# - list give another list, each item in list give another list, need to record in excel -


i have problem of iterating lists, , lists , lists, nested means each list cell contains list:

here problem:

my excel file contains paths of pages, need add more cells under these cells:

**admin/mypage.asp**  *add--> admin/mypage1.asp add--> admin/mypage2.asp add--> admin/mypage3.asp*  **admin/dir/mypage.asp**  *add--> admin/dir/mypage1.asp add--> admin/dir/mypage2.asp add--> admin/dir/mypage3.asp* 

i searched page: admin/mypage.asp, used htmlagilitypack, found links, pages, redirects on page,

pages found:  *admin/mypage1.asp  admin/mypage2.asp  admin/mypage3.asp* 

need note them under page in excel,

then these pages searched further links:

pages found: *admin/mypage1.asp  admin/mypage2.asp  admin/mypage3.asp* 

if more links found note them also

then search pages,

until no further page found.

i stuck here:

in nested lists how iterate each list , found new list, iterate new list, find other list iterate list,

then come previous lists have items pending.

how in c#


background: have list of paths, this, "admin/start.asp", in excel, there hundreds of this, them in list, , loop on each path, each path has page in it, on each page have extract paths using htmlagilitypack, , paths page searched , more paths these pages, until no more paths found in these pages, have keep on searching, have record them in excel. body have idea:

thanks

you can try this:

var alllistitems = new list(firstlist); (int listitemindex = 0; listitemindex < alllistitems.count; listitemindex++) {     alllistitems.addrange(alllistitems[listitemindex].items); } foreach (var listitem in alllistitems) {     //do } 

with firstlist being list start from.
breadth search adding nested lists alllistitems , iterating through them. works because alllistitems.count recalculated each iteration.
afterwards can iterate through items , whatever want.


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

android - CollapsingToolbarLayout: position the ExpandedText programmatically -

Listeners to visualise results of load test in JMeter -