本文整理汇总了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);
}
}
}