title: Binary Search on Keys of SortedList<K, V>
body: <p>I need to write some code for linear interpolation and I am trying to figure out the most efficient way to search the Keys of a <code>SortedList&lt;K, V&gt;</code> for the upper and lower keys that surround my target key.</p>
  
  <pre><code>SortedList&lt;int, double&gt; xyTable = new SortedList&lt;int, double&gt;()
  {
      {1, 10}, {2, 20}, {3, 30}, {4,40}
  };
  
  double targetX = 3.5;
  </code></pre>
  
  <p>What is the most efficient way to search the list and determine that 3.5 is between 3 and 4?  I have a method / cheat that works for integers (temporarily insert the target Key into the list then find the index) but I figured I'd ask the pros so I could produce quality code.</p>
  
  <p>Thanks.</p>