I have the following C# code.
public void HelloWorld()
{
Add(2, 2);
}
public void Add(int a, int b)
{
//Do something
}
It produces the following CIL
.method public hidebysig instance void HelloWorld() cil managed
{
// Code size 11 (0xb)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.0
IL_0002: ldc.i4.2
IL_0003: ldc.i4.2
IL_0004: call instance void ConsoleApplication3.Program::Add(int32,
int32)
IL_0009: nop
IL_000a: ret
} // end of method Program::HelloWorld
Now, what I don't understand is the line at offset 0001:
ldarg.0
I know what that opcode is for, but I don't really understand why it's being used in this method, as there are no arguments, right?
Does someone know why? :)