Since I am able to define several top-level nodes, I must conclude that a WebTree is only a real tree if these top-level nodes are attached to some common root node. I want access to this root node!
It is unnatural to treat the entire WebTree as something different as any other Node.
In my specific case, I have a method like this:
public void InsertMySubTree(Node parent) { foreach (...) { parent.Nodes.Add(...); ... } }
to insert my subtree into the WebTree at a certain point.
I can use it like this:
InsertMySubTree(tree.Nodes[2].Nodes[4].Nodes[1]);
This works fine as long as I don't want to insert my subtree at the top-level. Inserting at the top-level should just be a special case of inserting anywhere else in the tree. I should be able to do something like:
InsertMySubTree(tree.RootNode);
Nodes nodes = TaskTree.Nodes;Nodes nodes = node.Nodes;
InsertMySubTree(Nodes nodes);
public void InsertMySubTree(Nodes nodes) { foreach (...) { nodes.Add(...); ... } }
Just try this.
That doesn't make sense.
It doesn't do the same thing as the method I described, and it has a different interface, which was the entire point: I want to be able to use a method with the same signature regardless of where in the tree I want to put things (the root or somewhere else). You know, the normal way to use a tree?
just a suggestion, how about
InsertMySubTree( null )
so if it doesn't have any parent, it should be at root level