title: How can a B-tree node be represented?
body: <p>We're learning B-trees in class and have been asked to implement them in code. The teacher has left choice of programming language to us and I want to try and do it in C#. My problem is that the following structure is illegal in C#,</p>
  
  <pre><code>unsafe struct BtreeNode
          {
              int key_num;        // The number of keys in a node
              int[] key;          // Array of keys
              bool leaf;          // Is it a leaf node or not?
              BtreeNode*[] c;     // Pointers to next nodes
          }
  </code></pre>
  
  <p>Specifically, one is not allowed to create a pointer to point to the structure itself. Is there some work-around or alternate approach I could use? I'm fairly certain that there MUST be a way to do this within the managed code, but I can't figure it out. </p>
  
  <p>EDIT:
  Eric's answer pointed me in the right direction. Here's what I ended up using,</p>
  
  <pre><code>class BtreeNode
  {
          public List&lt;BtreeNode&gt; children;       // The child nodes
          public static int MinDeg;               // The Minimum Degree of the tree
          public bool IsLeaf { get; set; }        // Is the current node a leaf or not?
          public List&lt;int&gt; key;                   // The list of keys 
  ...
  }
  </code></pre>