Beispiel #1
0
        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);
                }
            }
        }