[Solved] C# tree data structure, making output


I won’t claim that I really know what you are asking, but still I’ll give it shot. To me this seems like a very basic recursion to traverse a tree structure with some weird output while you are doing it.
Try it like this:
1. Make an interface for all your classes called INode. This interface should contain the typical things like List Children, INode Parent etc.
2. Make all your classes implement this interface (or let them inherit a base class that does this)
3. Now start with your base clase and traverse recursively over all Children using the Children property and generate your output.

This should do the trick I guess. (Sorry, no VS here to put up some real code)

BTW: you’ll probably find a ton of posts about this on stackoverflow already.

0

solved C# tree data structure, making output