In practice, the memory associated with the corresponding slot in the array is filled with values. Given your code, a small example shows what happens. Please see comments on the line. This is for the release build.
static void Main(string[] args) { Foo[] foos = new Foo[10]; foos[1] = new Foo(127, 255); Console.ReadLine(); }
The above JIT code is compiled as follows
// Method setup 00280050 55 push ebp 00280051 8bec mov ebp,esp 00280053 56 push esi // Create instance of Foo[] 00280054 b98a141d00 mov ecx,1D148Ah 00280059 ba0a000000 mov edx,0Ah 0028005e e8b121f4ff call CORINFO_HELP_NEWARR_1_VC (001c2214) 00280063 8bd0 mov edx,eax // Array range check 00280065 837a0401 cmp dword ptr [edx+4],1 00280069 7624 jbe // Assign foos[1] = new Foo(127, 255) 0028006b 8d4210 lea eax,[edx+10h] <
In short, the code loads the constants in the registers, and then copies the values โโof these registers into the memory associated with the corresponding part of the array instance.
source share