Tree Collection

R

Reg

Hello,

Has C# 2.0 Tree Collection or is it missing?
There is a ThreeNodeCollection for Win Forms but not as an data structure.
How have you implement TreeCollection just for data storage?

Cheers,
 
P

Peter Duniho

Reg said:
Hello,

Has C# 2.0 Tree Collection or is it missing?
There is a ThreeNodeCollection for Win Forms but not as an data structure.
How have you implement TreeCollection just for data storage?

There is no specific class for this, AFAIK. The .NET Framework classes
all seem to implement their own variety of tree collections, with
features specific to their use (for example, the Control class has the
Controls property, tied to the Parent property of the contained instances).

It hasn't really come up much for me, but I find the List<> class is a
good general-purpose resizable collection class. If you need some kind
of non-ordered indexed access to the collection, the Dictionary<> class
is helpful. There are other collection classes that would be better in
other situations.

In fact, it's because of the wide variety of needs for a node's child
collection that various tree structures might have that I think may be
why there's no .NET base class for this sort of thing. It's not
difficult to implement your own tree structure, and doing so allows you
to choose a child node collection class that best suits your needs.

Pete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top