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


C# RuntimeTypeHandle.GetImplementedInterfaces方法代码示例

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


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

示例1: GetIIDsImpl

        private static void GetIIDsImpl(RuntimeTypeHandle typeHandle, System.Collections.Generic.Internal.List<Guid> iids)
        {
            RuntimeTypeHandle baseClass = typeHandle.GetBaseClass();
            if (!baseClass.IsNull())
            {
                GetIIDsImpl(baseClass, iids);
            } 

            foreach(RuntimeTypeHandle t in typeHandle.GetImplementedInterfaces())
            {
                if (t.IsInvalid())
                    continue;

                Guid guid = t.GetInterfaceGuid();
                //
                // Retrieve the GUID and add it to the list
                // Skip ICustomPropertyProvider - we've already added it as the first item
                //
                if (!InteropExtensions.GuidEquals(ref guid, ref Interop.COM.IID_ICustomPropertyProvider))
                {
                    //
                    // Avoid duplicated ones
                    //
                    // The duplicates comes from duplicated interface declarations in the metadata across
                    // parent/child classes, as well as the "injected" override interfaces for protected
                    // virtual methods (for example, if a derived class implements a IShapeInternal protected
                    // method, it only implements a protected method and doesn't implement IShapeInternal
                    // directly, and we have to "inject" it in MCG
                    //
                    // Doing a linear lookup is slow, but people typically never call GetIIDs perhaps except
                    // for debugging purposes (because the GUIDs returned back aren't exactly useful and you
                    // can't map it back to type), so I don't care about perf here that much
                    //
                    if (!iids.Contains(guid))
                        iids.Add(guid);
                }
            }
        }
开发者ID:nattress,项目名称:corert,代码行数:38,代码来源:McgTypeHelpers.cs


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