You're right to look for an alternative to writing your own binary tree
system, though there are some you could buy for .Net. Writing a very basic
one is not exactly trivial but then it is not terribly difficult either.
As an alternative, you could use something like a Hashtable or ArrayList to
store your structure, with each succeeding level being stored as another
Hashtable or ArrayList stored as an element of the first collection. But I
wouldn't. Keeping track of your levels of objects and the parent objects,
etc. can be as difficult as writing a simple binary tree.
Another option is to create a custom collection extending CollectionBase and
add a property to your custom collection that is another instance of its own
type. But, again, you'd have to code your own navigation implementation.
I suggest that you create an XmlDocument in memory and build your tree
there. XML is great for storing data in tree-like structures.
--
Dale Preston
MCAD C#
MCSE, MCDBA
"piotrek" wrote:
Hi
I would like to ask you a question.
Ian creating app. that download from server directory structure ( whole
tree ) and those data are placed in proper places into my treeview control.
I decided that the most effective way would be : When i connect to the
server once, I download the list and disconnect, instead of connecting every
time i go, to the lower node in my tree hierarhy.
Thus i have a problem - how to store data.
On the C++ i once created binary tree - i tought it might be good idea.
But when i googleed, i found an interesting for me note:
"In most cases binary trees can be replaced by use of one of the .NET
Framework container classes."
Can you tell me few words about this?
Do you think that in my case i should use container class, binary tree or
you have better idea.
Thanks
PK