Where does local variables actually allocated within CLR?
问题 I'm just going inside the CLR and IL and I'm confused by this thing. I have the following C# code: int x = 1; object obj = x; int y = (int)obj; And IL disassemble for this // Code size 18 (0x12) .maxstack 1 .locals init ([0] int32 x, [1] object obj, [2] int32 y) IL_0000: nop IL_0001: ldc.i4.1 IL_0002: stloc.0 IL_0003: ldloc.0 IL_0004: box [mscorlib]System.Int32 IL_0009: stloc.1 IL_000a: ldloc.1 IL_000b: unbox.any [mscorlib]System.Int32 IL_0010: stloc.2 IL_0011: ret So, the ldloc.0 instruction