public static void Main()
{
int[,] a = new int[3,4];
a[1, 1] = 10;
int y = a[1, 1];
Now the
ildasm shows me following output-
.method public hidebysig static void Main() cil managed
{
.entrypoint
.maxstack 4
.locals init ([0] int32[0...,0...] a,
[1] int32 y)
IL_0000: nop
IL_0001: ldc.i4.3
IL_0002: ldc.i4.4
IL_0003: newobj instance void int32[0...,0...]::.ctor(int32,
int32)
IL_0008: stloc.0
IL_0009: ldloc.0
IL_000a: ldc.i4.1
IL_000b: ldc.i4.1
IL_000c: ldc.i4.s 10
IL_000e: call instance void int32[0...,0...]::Set(int32,
int32,
int32)
IL_0013: ldloc.0
IL_0014: ldc.i4.1
IL_0015: ldc.i4.1
IL_0016: call instance int32 int32[0...,0...]::Get(int32,
int32)
IL_001b: stloc.1
IL_001c: ret
}
Now see also result for three dimentionl array
public static void Main()
{
int[,,] a = new int[3,4,3];
a[1, 1,2] = 10;
int y = a[1, 1,2];
}
Now see ildasm result
.method public hidebysig static void Main() cil managed
{
.entrypoint
.maxstack 5
.locals init ([0] int32[0...,0...,0...] a,
[1] int32 y)
IL_0000: nop
IL_0001: ldc.i4.3
IL_0002: ldc.i4.4
IL_0003: ldc.i4.3
IL_0004: newobj instance void int32[0...,0...,0...]::.ctor(int32,
int32,
int32)
IL_0009: stloc.0
IL_000a: ldloc.0
IL_000b: ldc.i4.1
IL_000c: ldc.i4.1
IL_000d: ldc.i4.2
IL_000e: ldc.i4.s 10
IL_0010: call instance void int32[0...,0...,0...]::Set(int32,
int32,
int32,
int32)
IL_0015: ldloc.0
IL_0016: ldc.i4.1
IL_0017: ldc.i4.1
IL_0018: ldc.i4.2
IL_0019: call instance int32 int32[0...,0...,0...]::Get(int32,
int32,
int32)
IL_001e: stloc.1
IL_001f: ret
}
Now my question is that
Is set,get,constructor of System.Array class uses params int[] as parameter
But if it is then reflection is not showing such "Set(params int[])"output in reflection.
How this result is possible?