Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
140
WebTree as Node
posted

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);

or something similar. But there is no way to get a Node representing the real root of the WebTree.

Why??