title: C# generic B+tree
body: <p>I'm implementing a B+tree using C#.</p>
  
  <p>Now as i understand it, a tree node should hold a number of (order - 1) keys, and order number of pointers to records or other nodes, i.e., only the leaf nodes would hold actual pointers to records , and internal nodes would hold pointers to other nodes.</p>
  
  <p>The problem I'm having with this implementation is with C# generics </p>
  
  <p>the Node Class is Declared as:</p>
  
  <pre><code>class Node&lt; K,V &gt;
  {
      K [] keys ;
      V [] values;
  }
  </code></pre>
  
  <p>Now when i attempt to place a node into the values array as such </p>
  
  <pre><code>_root.Values[0] = left ; // left being of type Node&lt;K,V&gt; 
  </code></pre>
  
  <p>I get the following Error:</p>
  
  <blockquote>
    <p>Cannot implicitly convert type 'BTree_Library.Node' to 'V'</p>
  </blockquote>
  
  <p>So, I'm trying to find a way to work around this, the other option is to change the implementation to hold one array for nodes and one for records.</p>
  
  <p>So, in conclusion :</p>
  
  <ol>
  <li><p>In C I would have used :<code>( void* values; )</code>
  I'm looking for an equivalent of that in C# .</p></li>
  <li><p>While we're on the subject did I understand the B+tree structure correctly 
  in reference to nodes and records being interchangeable for the nodes pointers?  </p></li>
  </ol>