3

Working in C#. I need a simple tree data type to store some objects.

Is there a native windows libraries tree data type?

I've looked in System.Collections.Generic but couldn't find anything.

Tried Googling it, all I see is custom built trees.

i3arnon
  • 113,022
  • 33
  • 324
  • 344
Tomas Beblar
  • 468
  • 4
  • 18

1 Answers1

4

No, There isn't a tree data type in .Net for two reasons:

  1. Trees are almost always built specifically for a certain usage and there isn't a general case for them like, for example, a dictionary.
  2. It's really simple to build a basic tree. You just write a TreeNode class that references 2 or more TreeNode children. Maybe add a Tree class to hold them. That's all.
i3arnon
  • 113,022
  • 33
  • 324
  • 344