• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# System.RuntimeMethodHandle类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.RuntimeMethodHandle的典型用法代码示例。如果您正苦于以下问题:C# RuntimeMethodHandle类的具体用法?C# RuntimeMethodHandle怎么用?C# RuntimeMethodHandle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



RuntimeMethodHandle类属于System命名空间,在下文中一共展示了RuntimeMethodHandle类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: OpenMethodResolver

 public unsafe OpenMethodResolver(RuntimeTypeHandle declaringTypeOfSlot, RuntimeMethodHandle gvmSlot, int handle)
 {
     _resolveType = GVMResolve;
     _methodHandleOrSlotOrCodePointer = *(IntPtr*)&gvmSlot;
     _declaringType = declaringTypeOfSlot;
     _handle = handle;
 }
开发者ID:noahfalk,项目名称:corert,代码行数:7,代码来源:OpenMethodResolver.cs


示例2: DeclareRoutine

        /// <summary>
        /// Adds referenced symbol into the map.
        /// In case of redeclaration, the handle is added to the list.
        /// </summary>
        public static void DeclareRoutine(string name, RuntimeMethodHandle handle)
        {
            // TODO: W lock

            int index;
            if (NameToIndex.TryGetValue(name, out index))
            {
                Debug.Assert(index != 0);

                if (index > 0)  // already taken by user routine
                {
                    throw new InvalidOperationException();
                }

                ((ClrRoutineInfo)AppRoutines[-index - 1]).AddOverload(handle);
            }
            else
            {
                index = -AppRoutines.Count - 1;
                var routine = new ClrRoutineInfo(index, name, handle);
                AppRoutines.Add(routine);
                NameToIndex[name] = index;

                // register the routine within the extensions table
                ExtensionsAppContext.ExtensionsTable.AddRoutine(routine);
            }
        }
开发者ID:iolevel,项目名称:peachpie,代码行数:31,代码来源:RoutinesTable.cs


示例3: RedirectCalls

 public static RedirectCallsState RedirectCalls(RuntimeMethodHandle from, RuntimeMethodHandle to)
 {
     // GetFunctionPointer enforces compilation of the method.
     var fptr1 = from.GetFunctionPointer();
     var fptr2 = to.GetFunctionPointer();
     return PatchJumpTo(fptr1, fptr2);
 }
开发者ID:Katalyst6,项目名称:CSL.TransitAddonMod,代码行数:7,代码来源:RedirectionHelper.cs


示例4: ArgumentInfo

 public ArgumentInfo(RuntimeMethodHandle getMethod, string name, bool optional, object defaultValue)
 {
     this.getMethod = getMethod;
     this.name = name;
     this.optional = optional;
     this.defaultValue = defaultValue;
 }
开发者ID:skidzTweak,项目名称:Aurora-Sim-3rdparty-Addon-Modules,代码行数:7,代码来源:ArgumentInfo.cs


示例5: GetMethodFromHandle

        public static MethodBase GetMethodFromHandle(RuntimeMethodHandle handle)
        {
            if (handle.IsNullHandle())
                throw new ArgumentException(Environment.GetResourceString("Argument_InvalidHandle"));

#if !FEATURE_CORECLR
            if (FrameworkEventSource.IsInitialized && FrameworkEventSource.Log.IsEnabled(EventLevel.Informational, FrameworkEventSource.Keywords.DynamicTypeUsage))
            {
                FrameworkEventSource.Log.BeginGetMethodFromHandle();
            }
#endif

            MethodBase m = RuntimeType.GetMethodBase(handle.GetMethodInfo());

            Type declaringType = m.DeclaringType;

#if !FEATURE_CORECLR
            if (FrameworkEventSource.IsInitialized && FrameworkEventSource.Log.IsEnabled(EventLevel.Informational, FrameworkEventSource.Keywords.DynamicTypeUsage)  && declaringType != null)
            {
                FrameworkEventSource.Log.EndGetMethodFromHandle(declaringType.GetFullNameForEtw(), m.GetFullNameForEtw());
            }
#endif

            if (declaringType != null && declaringType.IsGenericType)
                throw new ArgumentException(String.Format(
                    CultureInfo.CurrentCulture, Environment.GetResourceString("Argument_MethodDeclaringTypeGeneric"), 
                    m, declaringType.GetGenericTypeDefinition()));
 
            return m;
        }
开发者ID:peterdocter,项目名称:referencesource,代码行数:30,代码来源:methodbase.cs


示例6: GetMethodFromHandle

        public static MethodBase GetMethodFromHandle(RuntimeMethodHandle handle, RuntimeTypeHandle declaringType)
        {
            if (handle.IsNullHandle())
                throw new ArgumentException(Environment.GetResourceString("Argument_InvalidHandle"));

            return RuntimeType.GetMethodBase(declaringType.GetRuntimeType(), handle.GetMethodInfo());
        }
开发者ID:nietras,项目名称:coreclr,代码行数:7,代码来源:MethodBase.cs


示例7: GenerateDelegate

            private static FastInvoker GenerateDelegate(RuntimeMethodHandle methodHandle)
            {
                var methodInfo = (MethodInfo)MethodBase.GetMethodFromHandle(methodHandle);
                var dynamicMethod = new DynamicMethod(string.Empty, typeof(object), new[] { typeof(object), typeof(object[]) }, methodInfo.DeclaringType.Module);
                var il = dynamicMethod.GetILGenerator();
                var ps = methodInfo.GetParameters();
                var paramTypes = new Type[ps.Length];
                for (var i = 0; i < paramTypes.Length; i++)
                {
                    if (ps[i].ParameterType.IsByRef)
                    {
                        paramTypes[i] = ps[i].ParameterType.GetElementType();
                    }
                    else
                    {
                        paramTypes[i] = ps[i].ParameterType;
                    }
                }

                var locals = new LocalBuilder[paramTypes.Length];
                for (var i = 0; i < paramTypes.Length; i++)
                {
                    locals[i] = il.DeclareLocal(paramTypes[i], true);
                }

                for (var i = 0; i < paramTypes.Length; i++)
                {
                    il.Emit(OpCodes.Ldarg_1);
                    il.EmitFastInt(i);
                    il.Emit(OpCodes.Ldelem_Ref);
                    il.EmitCastToReference(paramTypes[i]);
                    il.Emit(OpCodes.Stloc, locals[i]);
                }

                if (!methodInfo.IsStatic)
                {
                    il.Emit(OpCodes.Ldarg_0);
                }

                for (var i = 0; i < paramTypes.Length; i++)
                {
                    il.Emit(ps[i].ParameterType.IsByRef ? OpCodes.Ldloca_S : OpCodes.Ldloc, locals[i]);
                }

                il.EmitCall(methodInfo.IsStatic ? OpCodes.Call : OpCodes.Callvirt, methodInfo, null);

                if (methodInfo.ReturnType == typeof(void))
                {
                    il.Emit(OpCodes.Ldnull);
                }
                else
                {
                    il.BoxIfNeeded(methodInfo.ReturnType);
                }

                il.Emit(OpCodes.Ret);
                var invoker = (FastInvoker)dynamicMethod.CreateDelegate(typeof(FastInvoker));
                return invoker;
            }
开发者ID:njmube,项目名称:Nemo,代码行数:59,代码来源:Reflector.Method.cs


示例8: CheckSetDemand

 internal bool CheckSetDemand(PermissionSet pset, RuntimeMethodHandle rmh)
 {
     this.CompleteConstruction(null);
     if (this.PLS == null)
     {
         return false;
     }
     return this.PLS.CheckSetDemand(pset, rmh);
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:9,代码来源:CompressedStack.cs


示例9: CheckDemand

 internal bool CheckDemand(CodeAccessPermission demand, PermissionToken permToken, RuntimeMethodHandle rmh)
 {
     this.CompleteConstruction(null);
     if (this.PLS != null)
     {
         this.PLS.CheckDemand(demand, permToken, rmh);
     }
     return false;
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:9,代码来源:CompressedStack.cs


示例10: ProxyInvocation

		public ProxyInvocation(Delegate callback, Func<Delegate, object[], object> callbackCaller,
			RuntimeMethodHandle methodHandle, RuntimeTypeHandle typeHandle, object proxy, object[] arguments)
		{
			this.callback = callback;
			this.callbackCaller = callbackCaller;
			this.methodHandle = methodHandle;
			this.typeHandle = typeHandle;
			this.proxy = proxy;
			this.arguments = arguments;
		}
开发者ID:ArthurYiL,项目名称:JustMockLite,代码行数:10,代码来源:ProxyInvocation.cs


示例11: RuntimeConstructorInfo

 internal RuntimeConstructorInfo(RuntimeMethodHandle handle, RuntimeTypeHandle declaringTypeHandle, RuntimeType.RuntimeTypeCache reflectedTypeCache, MethodAttributes methodAttributes, System.Reflection.BindingFlags bindingFlags)
 {
     this.m_bindingFlags = bindingFlags;
     this.m_handle = handle;
     this.m_reflectedTypeCache = reflectedTypeCache;
     this.m_declaringType = declaringTypeHandle.GetRuntimeType();
     this.m_parameters = null;
     this.m_toString = null;
     this.m_methodAttributes = methodAttributes;
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:10,代码来源:RuntimeConstructorInfo.cs


示例12: CreateCaObject

 private static unsafe object CreateCaObject(Module module, RuntimeMethodHandle ctor, ref IntPtr blob, IntPtr blobEnd, out int namedArgs)
 {
     int num;
     byte* ppBlob = (byte*) blob;
     byte* pEndBlob = (byte*) blobEnd;
     object obj2 = _CreateCaObject(module.ModuleHandle.Value, (void*) ctor.Value, &ppBlob, pEndBlob, &num);
     blob = (IntPtr) ppBlob;
     namedArgs = num;
     return obj2;
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:10,代码来源:CustomAttribute.cs


示例13: SetUp

		public void SetUp ()
		{
			if (!SecurityManager.SecurityEnabled)
				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");

			// we do this in SetUp because we want the security 
			// stack to be "normal/empty" so each unit test can 
			// mess with it as it wishes
			handle = typeof (RuntimeMethodHandleCas).GetMethod ("SetUp").MethodHandle;
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:10,代码来源:RuntimeMethodHandleCas.cs


示例14: GetGraphTypesFromMethodHandle

		/// <summary>
		/// Returns the graph types for a method specified by a method handle.
		/// </summary>
		/// <param name="handle">The handle to the method.</param>
		/// <returns>The graph types for the method.</returns>
		public static Type[] GetGraphTypesFromMethodHandle(RuntimeMethodHandle handle)
		{
			return _types.GetOrAdd(
				handle,
				h =>
				{
					MethodInfo method = (MethodInfo)MethodInfo.GetMethodFromHandle(h);
					var graphAttribute = method.GetCustomAttributes(false).OfType<DefaultGraphAttribute>().FirstOrDefault();

					return graphAttribute.GraphTypes;
				});
		}
开发者ID:erpframework,项目名称:Insight.Database,代码行数:17,代码来源:InterfaceGeneratorHelper.cs


示例15: MethodInvoker

        protected MethodInvoker( RuntimeMethodHandle targetMethod, Func<object> instanceFactory )
        {
            if ( instanceFactory == null )
            {
                throw new ArgumentNullException( "instanceFactory" );
            }

            Contract.EndContractBlock();

            this._targetMethod = targetMethod;
            this._instanceFactory = instanceFactory;
        }
开发者ID:yfakariya,项目名称:msgpack-rpc,代码行数:12,代码来源:MethodInvoker.cs


示例16: GetMethodFromHandle

 public static MethodBase GetMethodFromHandle(RuntimeMethodHandle handle)
 {
     if (handle.IsNullHandle())
     {
         throw new ArgumentException(Environment.GetResourceString("Argument_InvalidHandle"));
     }
     MethodBase methodBase = RuntimeType.GetMethodBase(handle);
     if ((methodBase.DeclaringType != null) && methodBase.DeclaringType.IsGenericType)
     {
         throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Argument_MethodDeclaringTypeGeneric"), new object[] { methodBase, methodBase.DeclaringType.GetGenericTypeDefinition() }));
     }
     return methodBase;
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:13,代码来源:MethodBase.cs


示例17: GVMLookupForSlot

        internal static unsafe IntPtr GVMLookupForSlot(RuntimeTypeHandle type, RuntimeMethodHandle slot)
        {
            RuntimeTypeHandle declaringTypeHandle;
            MethodNameAndSignature nameAndSignature;
            RuntimeTypeHandle[] genericMethodArgs;
            if (!RuntimeAugments.TypeLoaderCallbacks.GetRuntimeMethodHandleComponents(slot, out declaringTypeHandle, out nameAndSignature, out genericMethodArgs))
            {
                System.Diagnostics.Debug.Assert(false);
                return IntPtr.Zero;
            }

            return GVMLookupForSlotWorker(type, declaringTypeHandle, genericMethodArgs, nameAndSignature);
        }
开发者ID:justinvp,项目名称:corert,代码行数:13,代码来源:GenericVirtualMethodSupport.cs


示例18: SignatureStruct

 public unsafe SignatureStruct(RuntimeMethodHandle method, RuntimeTypeHandle[] arguments, RuntimeTypeHandle returnType, CallingConventions callingConvention)
 {
     this.m_pMethod = method;
     this.m_arguments = arguments;
     this.m_returnTypeORfieldType = returnType;
     this.m_managedCallingConvention = callingConvention;
     this.m_sig = null;
     this.m_pCallTarget = null;
     this.m_csig = 0;
     this.m_numVirtualFixedArgs = 0;
     this.m_64bitpad = 0;
     this.m_declaringType = new RuntimeTypeHandle();
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:13,代码来源:SignatureStruct.cs


示例19: GetMethodFromHandle

        //
        // This overload of GetMethodForHandle only accepts handles for methods declared on non-generic types (the method, however,
        // can be an instance of a generic method.) To resolve handles for methods declared on generic types, you must pass
        // the declaring type explicitly using the two-argument overload of GetMethodFromHandle.
        //
        // This is a vestige from desktop generic sharing that got itself enshrined in the code generated by the C# compiler for Linq Expressions.
        //
        public sealed override MethodBase GetMethodFromHandle(RuntimeMethodHandle runtimeMethodHandle)
        {
            ExecutionEnvironment executionEnvironment = ReflectionCoreExecution.ExecutionEnvironment;
            MethodHandle methodHandle;
            RuntimeTypeHandle declaringTypeHandle;
            RuntimeTypeHandle[] genericMethodTypeArgumentHandles;
            if (!executionEnvironment.TryGetMethodFromHandle(runtimeMethodHandle, out declaringTypeHandle, out methodHandle, out genericMethodTypeArgumentHandles))
                throw new ArgumentException(SR.Argument_InvalidHandle);

            MethodBase methodBase = ReflectionCoreExecution.ExecutionDomain.GetMethod(declaringTypeHandle, methodHandle, genericMethodTypeArgumentHandles);
            if (methodBase.DeclaringType.IsConstructedGenericType)  // For compat with desktop, insist that the caller pass us the declaring type to resolve members of generic types.
                throw new ArgumentException(SR.Format(SR.Argument_MethodDeclaringTypeGeneric, methodBase));
            return methodBase;
        }
开发者ID:kyulee1,项目名称:corert,代码行数:21,代码来源:ReflectionCoreCallbacksImplementation.cs


示例20: GetMethodFromHandle

        public static MethodBase GetMethodFromHandle(RuntimeMethodHandle handle, RuntimeTypeHandle declaringType)
        {
            if (handle.IsNullHandle())
                throw new ArgumentException(Environment.GetResourceString("Argument_InvalidHandle"));

#if MONO
            MethodBase m = GetMethodFromHandleInternalType (handle.Value, declaringType.Value);
            if (m == null)
                throw new ArgumentException ("The handle is invalid.");
            return m;
#else
            return RuntimeType.GetMethodBase(declaringType.GetRuntimeType(), handle.GetMethodInfo());
#endif
        }
开发者ID:stormleoxia,项目名称:referencesource,代码行数:14,代码来源:methodbase.cs



注:本文中的System.RuntimeMethodHandle类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# System.RuntimeMethodHandleInternal类代码示例发布时间:2022-05-26
下一篇:
C# System.RuntimeFieldHandleInternal类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap