Collection type to represent hierarchical structure in .Net 3.5

I have experimented with various methods for representing hierarchical structures in memory that would allow transversally both up and down in a simple and efficient way to discover ancestor-descendant relationships. Does anyone have any suggestions or examples of options that I have? Is there a collection type in .Net 3.5 that helps here?

0


source to share


5 answers


So you want a Tree ? FGI



+1


source


How do I create my own node that looks something like this:

  class Node<T> {
    public T Item;
    public LinkedList<T> Children;
  }

      



Then apply node recursively as needed

0


source


0


source


I'm afraid there is nothing there by default. Make your own.

0


source


I am using LINQ to traverse hierarchical structures that I have downloaded from XML Web Services, but I am sure LINQ will share well to traverse your collection of trees.

-Mike

PS. I mention this because LINQ is just fun.

0


source







All Articles