Hey Philip,
On 4/6/09, Philip_L <[email protected]> wrote:
> switch(someString)
> {
> case "a":
> break;
> case "b":
> break;
> default:
> break;
That's compiled using a Dictionary<>. A switch is quite complex
actually. If you have:
int a;
switch (a) {
case 0:
case 1:
case 12:
case 74:
}
It's likely that only the case 0 and 1 will be compiled using a switch
opcode, the rest will be compiled as a short serie of comparison. I
suggest you write a few examples and see in ildasm what csc emits,
it's quite interesting (I had to do that for Cecil.Decompiler, it's
actually not that fun to reconstruct a switch statement from what is
actually compiled).
--
Jb Evain <[email protected]>
--~--~---------~--~----~------------~-------~--~----~
--
mono-cecil
-~----------~----~----~----~------~----~------~--~---