Esempio n. 1
0
        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;
        }
Esempio n. 2
0
        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;
        }
Esempio n. 3
0
        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;
        }
Esempio n. 4
0
 public static ILGenerator ldftn(this ILGenerator il, MethodBase mb)
 {
     il.Emit(OpCodes.Ldftn, mb.AssertCast<MethodInfo>());
     return il;
 }