It seams that Microsoft's C# compiler would do things differently:

For small switch cases, like in your example with only two values "a"
& "b", the generated code would be something like that :

if(String.op_Equality(someString, "a"))
{
    // case a
}
else if(String.op_Equality(someString, "b"))
{
    // case b
}
else
{
    // case default
}

But for larger test cases, it seams to use a more sophisticated
approach. in fact it uses a Dictionary<string, int>.

--~--~---------~--~----~------------~-------~--~----~
--
mono-cecil
-~----------~----~----~----~------~----~------~--~---

Reply via email to