A Practical Guide to MSIL - Method Invocation

Method call instructions mainly include Call and Callvirt.

To call a static or sealed method, use the Call instruction.

To call a virtual or abstract modified method, use the Callvirt instruction.

Code example:

ilGenerator.Emit(OpCodes.Call, typeof(Console).GetMethod("WriteLine", new Type[] { typeof(int)}));

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324613223&siteId=291194637