Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IL Callvirt equivalence?

Tags:

c#

il

Is il.EmitCall(OpCodes.Callvirt, getter, null);

the same as:

to il.Emit(OpCodes.Callvirt,getter);

I'm not sure how to examine the IL that is generated on the fly, so... this is the second related question.

like image 583
sgtz Avatar asked Dec 31 '25 22:12

sgtz


1 Answers

Yes.

The source for Emit(OpCode, MethodInfo) begins with (after validation)

if (opcode.Equals(OpCodes.Call) || opcode.Equals(OpCodes.Callvirt) || opcode.Equals(OpCodes.Newobj)) 
{
    EmitCall(opcode, meth, null); 
} 
like image 112
SLaks Avatar answered Jan 02 '26 12:01

SLaks



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!