You're not compiling with optimizations - the nop
instruction is indicative of this (the compiler inserts these to use as anchors, so that you can put a breakpoint on a brace).
Visual Studio won't always produce optimized code, even if you have the 'optimize code' checkbox checked. Often when you launch in the debugger, it will disable optimizations anyway so that the debugging session behaves moreso as you would expect.
Furthermore, you're not comparing apples to apples, which accounts for a lot more of the cruft.
string[].Length
is a property in C#, not a public variable, and furthermore, not a local variable. Properties are often treated like public variables by consuming code, but in reality can exist as full-blown get/set methods. The compiler has to emit code to handle this, especially when the Property is defined in a separate assembly.
Try the example with a local int
variable, and with compiler optimizations turned on (build with optimizations, launch the program, attach the debugger after launching, view disassembly).