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


C# TypeDesc.GetMethods方法代码示例

本文整理汇总了C#中Internal.TypeSystem.TypeDesc.GetMethods方法的典型用法代码示例。如果您正苦于以下问题:C# TypeDesc.GetMethods方法的具体用法?C# TypeDesc.GetMethods怎么用?C# TypeDesc.GetMethods使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Internal.TypeSystem.TypeDesc的用法示例。


在下文中一共展示了TypeDesc.GetMethods方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RootMethods

        private void RootMethods(TypeDesc type, string reason, IRootingServiceProvider rootProvider)
        {
            foreach (MethodDesc method in type.GetMethods())
            {
                // Skip methods with no IL and uninstantiated generic methods
                if (method.IsIntrinsic || method.IsAbstract || method.HasInstantiation)
                    continue;

                if (method.IsInternalCall)
                    continue;

                try
                {
                    CheckCanGenerateMethod(method);
                    rootProvider.AddCompilationRoot(method, reason);
                }
                catch (TypeSystemException)
                {
                    // TODO: fail compilation if a switch was passed

                    // Individual methods can fail to load types referenced in their signatures.
                    // Skip them in library mode since they're not going to be callable.
                    continue;

                    // TODO: Log as a warning
                }
            }
        }
开发者ID:nattress,项目名称:corert,代码行数:28,代码来源:LibraryRootProvider.cs

示例2: ComputeAllVirtualMethods

 public override IEnumerable<MethodDesc> ComputeAllVirtualMethods(TypeDesc type)
 {
     foreach (var method in type.GetMethods())
     {
         if (method.IsVirtual)
             yield return method;
     }
 }
开发者ID:tijoytom,项目名称:corert,代码行数:8,代码来源:MetadataVirtualMethodEnumerationAlgorithm.cs

示例3: RootMethods

        private void RootMethods(TypeDesc type, string reason, IRootingServiceProvider rootProvider)
        {
            foreach (MethodDesc method in type.GetMethods())
            {
                // Skip methods with no IL and uninstantiated generic methods
                if (method.IsIntrinsic || method.IsAbstract || method.ContainsGenericVariables)
                    continue;

                if (method.IsInternalCall)
                    continue;

                rootProvider.AddCompilationRoot(method, reason);
            }
        }
开发者ID:krytarowski,项目名称:corert,代码行数:14,代码来源:MultiFileCompilationModuleGroup.cs

示例4: TryGetMethodFromInterfaceSlot

        /// <summary>
        /// Get the MethodDesc that corresponds to an interface type/slot pair
        /// </summary>
        public static bool TryGetMethodFromInterfaceSlot(TypeDesc owningType, ushort slot, out MethodDesc method)
        {
            int iMethod = -1;
            method = null;

            // This is only valid to call on an interface
            if (!owningType.IsInterface)
                return false;

            // Slots on generic interface types are off by one.
            if (owningType.IsGeneric())
            {
                if (slot == 0)
                    throw new BadImageFormatException();

                slot--;
            }

            foreach (MethodDesc searchMethod in owningType.GetMethods())
            {
                if (searchMethod.IsVirtual)
                {
                    iMethod++;
                    if (iMethod == slot)
                    {
                        method = searchMethod;
                        return true;
                    }
                }
            }

            return false;
        }
开发者ID:nattress,项目名称:corert,代码行数:36,代码来源:LazyVtableResolverThunk.cs


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