public static ILGenerator ld_method_info(this ILGenerator il, MethodBase methodBase) { if (methodBase == null) throw new ArgumentNullException("methodBase"); // todo. use hackarounds (see the Hackarounds namespace nearby)! il.Emit(OpCodes.Ldtoken, methodBase.AssertCast<MethodInfo>()); il.Emit(OpCodes.Ldtoken, methodBase.DeclaringType); il.EmitCall(OpCodes.Call, typeof(MethodBase).GetMethod("GetMethodFromHandle", new[] { typeof(RuntimeMethodHandle), typeof(RuntimeTypeHandle) }), null); return il; }
public static ILGenerator newobj(this ILGenerator il, MethodBase ctor) { if (ctor == null) throw new ArgumentNullException("ctor"); // todo. use hackarounds (see the Hackarounds namespace nearby)! il.Emit(OpCodes.Newobj, ctor.AssertCast<ConstructorInfo>()); return il; }
public static ILGenerator ldtoken(this ILGenerator il, MethodBase methodBase) { if (methodBase == null) throw new ArgumentNullException("methodBase"); // todo. use hackarounds (see the Hackarounds namespace nearby)! il.Emit(OpCodes.Ldtoken, methodBase.AssertCast<MethodInfo>()); return il; }
public static ILGenerator ldftn(this ILGenerator il, MethodBase mb) { il.Emit(OpCodes.Ldftn, mb.AssertCast<MethodInfo>()); return il; }