Exemplo n.º 1
0
 /// <summary>
 /// Write a Call to a method using Calli
 /// </summary>
 /// <param name="il">LazyILGenerator instance</param>
 /// <param name="method">Method to get called</param>
 internal static void WriteMethodCalli(this LazyILGenerator il, MethodInfo method)
 {
     il.Emit(OpCodes.Ldc_I8, (long)method.MethodHandle.GetFunctionPointer());
     il.Emit(OpCodes.Conv_I);
     il.EmitCalli(
         OpCodes.Calli,
         method.CallingConvention,
         method.ReturnType,
         method.GetParameters().Select(p => p.ParameterType).ToArray(),
         null);
 }