如何在Mono.Cecil中发出对String.op_Equality的调用

Ear*_*rlz 0 .net reflection il mono.cecil

我正在尝试使用Mono.Cecil将代码注入程序集.到目前为止,一切都很好,但现在我正在尝试实现IL的这一点:

call bool [mscorlib]System.String::op_Equality(string, string)
Run Code Online (Sandbox Code Playgroud)

我怎么在塞西尔这样做?我知道它就像是

var il=mymethod.Body.GetIlProcessor();
...
il.Emit(Opcodes.Call, ????);
Run Code Online (Sandbox Code Playgroud)

我不知道要发送什么样的参数或如何获取对该静态函数的引用.

我该怎么做呢?

Sim*_*ier 5

像这样的东西:

MethodReference ope = myMainModule.Import(typeof(string).GetMethod("op_Equality"));
il.Emit(Opcodes.Call, ope);
Run Code Online (Sandbox Code Playgroud)