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?
So you want a Tree ? FGI
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
System.Web.UI.IHierarchicalEnumerable
- an interesting template.
I'm afraid there is nothing there by default. Make your own.
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.