Пример #1
0
        static StackObject *get_RealType_1(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            ILRuntime.Reflection.ILRuntimeWrapperType instance_of_this_method = (ILRuntime.Reflection.ILRuntimeWrapperType) typeof(ILRuntime.Reflection.ILRuntimeWrapperType).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.RealType;

            return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method));
        }
Пример #2
0
 public override Delegate CreateDelegate(Type t)
 {
     if (t is ILRuntimeType)
     {
         ILType it = ((ILRuntimeType)t).ILType;
         if (it.IsDelegate)
         {
             var ilMethod = ILMethod;
             if (ilMethod.DelegateAdapter == null)
             {
                 var m = it.GetMethod("Invoke") as ILMethod;
                 ilMethod.DelegateAdapter = appdomain.DelegateManager.FindDelegateAdapter(null, ilMethod, m);
             }
             return(ilMethod.DelegateAdapter.Delegate);
         }
         else
         {
             throw new NotSupportedException(string.Format("{0} is not Delegate", t.FullName));
         }
     }
     else if (t is ILRuntimeWrapperType)
     {
         ILRuntimeWrapperType iwt = (ILRuntimeWrapperType)t;
         return(appdomain.DelegateManager.FindDelegateAdapter(iwt.CLRType, null, ILMethod).Delegate);
     }
     else
     {
         CLRType clrType = appdomain.GetType(t) as CLRType;
         if (clrType != null)
         {
             return(appdomain.DelegateManager.FindDelegateAdapter(clrType, null, ILMethod).Delegate);
         }
         else
         {
             throw new NotSupportedException();
         }
     }
 }