Tree structure

  • Thread starter Thread starter Rakesh
  • Start date Start date
R

Rakesh

Is there any structure/class with which I could represent
Tree data structures in .NET ?

Thanks
Rakesh
 
hi Rakesh
There is The System.Collections namespace contains
interfaces and classes that define various collections of
objects, such as lists, queues, bit arrays, hashtables
and dictionaries.
You can use the ArrayList class of that namespace. This
class Implements the IList interface using an array whose
size is dynamically increased as required. Then you file
each element of these with another Arraylist , this way
you will get the tree structure.
Or , you can use CollectionBase class of the same name
space . this one Provides the abstract base class for a
strongly typed collection. Use it to implement your own
tree. i hope this helps

mohamoss
 
Wrong.

He asks for data structures, not for visualization.

There is no inhereent tree in .NET - you have to create one by using
mutliple collections out of the System.Collections namespace, like multiple
arraylists.

Thomas Tomiczek
THONA Software & Consulting Ltd.
(Microsoft MVP C#/.NET)
 
There is a class called TreeNode, which I would recommand.

you use it something like this:

TreeNode root = new TreeNode("The Root");
TreeNode leave1 = new Treenode("A Leave");
root.Nodes.Add(leave1);

hope this helps
daFritz
____________________________
For further questions: (e-mail address removed)
 
Back
Top