当前位置: 首页>>代码示例>>C#>>正文


C# System.RuntimeMethodHandle类代码示例

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


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


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