What is the best data structure for tree data of fixed depth in C #?

advertisements

What is the optimal (easy to maintain, reasonably fast, robust) implementation of tree-like data structure with three levels? I would like to use Dictionary or SortedDictionary, because all values (nodes) have unique keys.

The first level is supposed to have about 300 items, every of these zero to tens (hardly more than 100, usually less than 10) items on second level and about ten on third level. Levels two and three are closely connected so they should be probably represented by a single object. All the relations are 1:n

++-L1
|++-L2
||+--L3
||+--...1 to 10 L3 items for each L2
||+--L3
|+--L2
|+--...0 to 100, usually <10 L2 items for each L1
|+--L2
+--L1
+--L1
+--...about 300 L1 items
+--L1

Is it better to create a dictionary in every 1st level object containing level2 objects (a real tree) or is it better to put all 2nd level objects into a single directory?

The objects are not very big, they contain only some strings and numbers. The application is supposed to be standalone (not needing any sql server or so)

Or is object representation a wrong choice and I should go for something totally different?


Why not just make a TreeNode class?

class TreeNode
{
  private string _name;
  private int _someNumber;
  private int _uniqueId;
  private List<TreeNode> _childNodes;

  public string Name{get{return _name;}}
  public int SomeNumber{get{return _someNumber;}}
  public int UniqueId{get{return _uniqueId;}}
  public List<TreeNode> ChildNodes{get{return _childNodes;}}

  public void TreeNode(string name, int someNumber, int uniqueId)
  {
    _name=name;
    _someNumber=someNumber;
    _uniqueId = uniqueId;
    _childNodes = new List<TreeNode>();
  }

  public void AddNode(TreeNode node)
  {
    _childNodes.Add(node);
  }

  // other code for deleting, searching, etc.
}