【发布时间】:2012-09-30 07:04:00
【问题描述】:
我有以下 C# 代码:
public static double f2(Func<double, double> f, double x)
{
return f(x);
}
这里是 IL 代码:
.method public hidebysig static
float64 f2 (
class [mscorlib]System.Func`2<float64, float64> f,
float64 x
) cil managed
{
// Method begins at RVA 0x20bd
// Code size 8 (0x8)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: callvirt instance !1 class [mscorlib]System.Func`2<float64, float64>::Invoke(!0)
IL_0007: ret
}
我怎样才能发射
callvirt instance !1 class [mscorlib]System.Func`2<float64, float64>::Invoke(!0)
通过 System.Reflection.Emit 或通过 Mono.Cecil 更好地指导?
!1 和 !0 代表什么?
【问题讨论】:
标签: c# .net reflection.emit il mono.cecil