performance - What is the most efficient way to do look-up table in C# -
What is the most effective way to table lookup in C #
Up tables such as < / P>
0 "thing 1" 1 "thing 2" 2 "reserved" 3 "reserved" 4 "reserved" 5 "no problem"
Someone wants "thing 1" or "thing 2" to pass through 0 or 1. But they can pass some more, I have 256 such types of things and maybe 200 of them are reserved.
Want to set it so what's most efficient?
- A string array or dictionary variable that receives all values and then rounds up and returns values to that location.
I have a problem with this problem "safe" value I do not want to make those unnecessary "reserved" values or else I can have an I statement against "reserved" all different locations , But now they can only be 2-3, can be 2-3, 40-55 and byte in all the different places. This statement, if uncontrolled is accelerated then
- My second option which I was thinking was a switch statement. And I will have all 50ish known values and they will fall through reserve values and through default.
I am thinking that there is too much processing by making this string array or making a dictionary and returning the proper value.
- Something else?
The way? Var things = new dictionary & lt; Int, string & gt; (); Things [0] = "Cheese 1"; Things [1] = "thing 2"; Things [4711] = "Carmen Sandigo";
Comments
Post a Comment