Re: Unique identifier in every treenode?
- From: "Peter Duniho" <NpOeStPeAdM@xxxxxxxxxxxxxxxx>
- Date: Thu, 03 Jan 2008 12:05:08 -0800
On Thu, 03 Jan 2008 11:40:34 -0800, Rob Stevens <robbstephens@xxxxxxxxxx> wrote:
Is there some sort of unique identifier in every treenode
that is consistent? I was looking at the handle of every
treenode, but it appears that the handle changes everytime
the tree is built.
I have seen in some databases where they store the treenodes
they are using some serial number of the node. I don't have
a clue what that is, but can someone tell me if there is something
that is unique to every node.
Not by default, no. It would be up to the client code (i.e. what you write) to impose any sort of unique identifier and store it with the TreeNode (you can either use the TreeNode.Tag property to store something, or subclass the TreeNode class and put whatever you want in that derived class).
You may or may not actually need to store a unique identifier. Even in a regular database you can use the database itself to specify relationships between records in the database representing nodes, something like XML provides a natural "containment" semantic that would allow the tree structure to be represented without explicit references between nodes, and even a plain text file can be used to reliably store a tree structure as long as you have _some_ way of describing the structure (for example, instead of specifying explicit relationships between nodes, simply storing a given node's depth within the tree along with making sure the nodes are stored and recovered in a specific order is sufficient...this was even a recent example in a previous thread in this newsgroup).
Pete
.
- References:
- Unique identifier in every treenode?
- From: Rob Stevens
- Unique identifier in every treenode?
- Prev by Date: Re: Unique identifier in every treenode?
- Next by Date: Re: using hashtables
- Previous by thread: Re: Unique identifier in every treenode?
- Next by thread: Re: C++ or C#..?
- Index(es):
Relevant Pages
|