List<>

  • Thread starter Thread starter Nikolay Podkolzin
  • Start date Start date
N

Nikolay Podkolzin

Good Noon, Community!



Could you be so nice and help me with my problem, I need To enumerate all
items in List, but, it List contains a Node with next Parameters:



public class Node

{

....

public bool HasSubMenu;

....

}



public class NodeCollection : List<Node>

{

}



And when I enumerate this, and if in the property HasSubMenu is true I need
to recursive enumerate all subMenus. How Could I do that correctly? And When
it meet the hasSubMenu Program have to do indent



Main Menu

Point 1.HasSubMenu = false

Point 2.hasSubMenu = true

point2.1

point2.2 etc...



Its Asp.net Application.



Thanks in advance
 
Nikolay Podkolzin said:
Good Noon, Community!



Could you be so nice and help me with my problem, I need To enumerate
all
items in List, but, it List contains a Node with next Parameters:
<Snip>

Sniff......Sniff.....do I smell homework?

Well...whether it is homework or not I will give you the following
advice.

Make a stab at this problem yourself before posting here.
Have some code that is not working and ask what you are doing wrong.

People in this group will gladly guide you, but they will not do your
work for you.

Bill
 
Good Noon, Community!



Could you be so nice and help me with my problem, I need To enumerate all
items in List, but, it List contains a Node with next Parameters:
First write code to enumerate a list where there are no sub menus.
Test it on different lists and check that it works correctly.

Now write a separate function to enumerate a sub menu. Again test and
check.

Lastly combine the two. You will have done your homework.

[snip]
And when I enumerate this, and if in the property HasSubMenu is true I need
to recursive enumerate all subMenus. How Could I do that correctly?
Something like:
if (currentListItem.hasSubMenu) { enumerateSubMenu(); }

And When
it meet the hasSubMenu Program have to do indent
Indentation is just adding some spaces to the start of each displayed
line. Can you write a program to output:

*
*
*
*
*

rossum
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top