All pastes #12048 Raw Edit

Untitled

public text v1 · immutable
#12048 ·published 2005-05-18 14:16 UTC
rendered paste body
The C#:
        public static void Main (string[] args)
        {       
                int i = 3;

                switch (i)
                {       
                        case 2: 
                                Console.WriteLine("2");
                                break;
                        case 4: 
                                Console.WriteLine("4");
                                break;
                        case 5: 
                                Console.WriteLine("5");
                                break;
                        case 3: 
                                Console.WriteLine("3");
                                break;
                }
        }

The IL:

    // method line 2
    .method public static  hidebysig 
           default void Main (string[] args)  cil managed 
    {
        // Method begins at RVA 0x20f4
        .entrypoint
        // Code size 94 (0x5e)
        .maxstack 5
        .locals init (
                int32   V_0,
                int32   V_1)
        IL_0000:  ldc.i4.3 
        IL_0001:  stloc.0 
        IL_0002:  ldloc.0 
        IL_0003:  stloc.1 
        IL_0004:  ldloc.1 
        IL_0005:  ldc.i4.2 
        IL_0006:  sub 
        IL_0007:  switch (
          IL_0021,
          IL_004e,
          IL_0030,
          IL_003f)
        IL_001c:  br IL_005d

        IL_0021:  ldstr "2"
        IL_0026:  call void class [mscorlib]System.Console::WriteLine(string)
        IL_002b:  br IL_005d

        IL_0030:  ldstr "4"
        IL_0035:  call void class [mscorlib]System.Console::WriteLine(string)
        IL_003a:  br IL_005d

        IL_003f:  ldstr "5"
        IL_0044:  call void class [mscorlib]System.Console::WriteLine(string)
        IL_0049:  br IL_005d

        IL_004e:  ldstr "3"
        IL_0053:  call void class [mscorlib]System.Console::WriteLine(string)
        IL_0058:  br IL_005d

        IL_005d:  ret 
    } // end of method Switcher::default void Main (string[] args)