nop啥的咱还能理解,红色部分实在理解不能.特别是那个
br.s IL_0022
除了浪费点执行时间还有啥用?
.method public hidebysig static object Invoke(class [mscorlib]System.Func`4<bool,int32,string,object> func,
object[] argv) cil managed
{
// 代码大小 36 (0x24)
.maxstack 5
.locals init (object V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: ldarg.1
IL_0003: ldc.i4.0
IL_0004: ldelem.ref
IL_0005: unbox.any [mscorlib]System.Boolean
IL_000a: ldarg.1
IL_000b: ldc.i4.1
IL_000c: ldelem.ref
IL_000d: unbox.any [mscorlib]System.Int32
IL_0012: ldarg.1
IL_0013: ldc.i4.2
IL_0014: ldelem.ref
IL_0015: castclass [mscorlib]System.String
IL_001a: callvirt instance !3 class [mscorlib]System.Func`4<bool,int32,string,object>::Invoke(!0,
!1,
!2)
IL_001f: stloc.0
IL_0020: br.s IL_0022
IL_0022: ldloc.0
IL_0023: ret
} // end of method test::Invoke
源程序:
public static object Invoke(Func<bool,int,string, object> func, object[] argv)
{
return func((bool)argv[0],(int)argv[1],(string)argv[2]);
}
c#编译器版本:
Microsoft(R) Visual C# 2010 编译器 4.0.30319.1 版