title: List of Numbers - How to Efficiently Find Largest Less Than or Equal to N
body: <p>Say I have a fixed set of numbers that happens to be sorted:</p>
  
  <pre><code>static readonly int[] numbers = new int {
      1, 200, 204, 228, 298, 300, 331, 332, ... 2983
  };
  </code></pre>
  
  <p>How would I efficiently find the largest number less than or equal to an arbitrary value.  The function I am trying to create is as follows:</p>
  
  <pre><code>public int LessThanOrEqualTo(int n)
  {
      // ???
  }
  </code></pre>
  
  <p>The simplest way would be to iterate over the set every time.  However, I am looking for a way to make this faster.  I am ok converting this to another format such as an <code>IDictionary</code>, but cannot think of a clever way do this offhand.</p>