What is the most efficient way to view a lookup table in C #
I have a lookup table. Similar to
0 "Thing 1"
1 "Thing 2"
2 "Reserved"
3 "Reserved"
4 "Reserved"
5 "Not a Thing"
So, if someone wants to "Thing 1" or "Thing 2", they pass at 0 or 1. But they can pass in another. I have 256 of these things and maybe 200 of them are reserved.
So, what do you most effectively want to customize?
- An array string or dictionary variable that receives all values. And then take an integer and return the value at that place.
One problem with this solution is all the Reserved values. I do not want to create these redundant "reserved" values. Or else, I may have an if statement in all the different places that are "reserved", but now they can be only 2-3, maybe 2-3, 40-55 and all different places in the byte. This if statement will be uncontrollably fast.
- My other option that I was thinking about was a switch statement. And I would have all 50-digit values and would fail by default for the reserved values.
I am wondering if this is a lot more processing than creating a string array or dictionary and just returning the appropriate value.
- Something else? Is there any other way to consider?