title: What is the most efficient way to do look-up table in C#
body: <p>What is the most efficient way to do look-up table in C#</p>
  
  <p>I have a look-up table. Sort of like</p>
  
  <pre><code>0 "Thing 1"
  1 "Thing 2"
  2 "Reserved"
  3 "Reserved"
  4 "Reserved"
  5 "Not a Thing"
  </code></pre>
  
  <p>So if someone wants "Thing 1" or "Thing 2" they pass in 0 or 1. But they may pass in something else also.
  I have 256 of these type of things and maybe 200 of them are reserved.</p>
  
  <p>So what is the most efficient want to set this up?</p>
  
  <ul>
  <li>A string Array or dictionary variable that gets all of the values. And then take the integer and return the value at that place. </li>
  </ul>
  
  <p>One problem I have with this solution is all of the "Reserved" values. I don't want to create those redundant "reserved" values. Or else I can have an if statement against all of the various places that are "reserved" but they might now be just 2-3, might be 2-3, 40-55 and all different places in the byte. This if statement would get unruly quick</p>
  
  <ul>
  <li>My other option that I was thinking was a switch statement. And I would have all of the 50ish known values and would fall through through and default for the reserved values. </li>
  </ul>
  
  <p>I am wondering if this is a lot more processing than creating a string array or dictionary and just returning the appropriate value.</p>
  
  <ul>
  <li>Something else? Is there another way to consider?</li>
  </ul>