Can someone explain to me what needs to be loaded into the stack prior to making a function call via reflection.emit?
I have a very simple method
public static void Execute(string 1, string 2)
I want to generate the method in the following class dynamically (forget the rest, I got them sorted out)
public class Test{
public string s1;
public void Run(string s2)
{
MyOtherClass.Execute(s2,s1)
}
}
I have a copy of the above test, for reference, and I noticed the following opcodes were emitted, prior to the "call".
- ldarg_1
- ldarg_0
- ldfld
The question is what's ldarg_0 doing there? I only need 2 arguments for the call, why does the CLR requires ldarg_0 to be pushed to the stack?