本文整理汇总了C#中RuntimeTypeHandle.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# RuntimeTypeHandle.Equals方法的具体用法?C# RuntimeTypeHandle.Equals怎么用?C# RuntimeTypeHandle.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RuntimeTypeHandle
的用法示例。
在下文中一共展示了RuntimeTypeHandle.Equals方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindMatchingInterfaceSlot
private bool FindMatchingInterfaceSlot(IntPtr moduleHandle, NativeReader nativeLayoutReader, ref NativeParser entryParser, ref ExternalReferencesTable extRefs, ref RuntimeTypeHandle declaringType, ref MethodNameAndSignature methodNameAndSignature, RuntimeTypeHandle openTargetTypeHandle, RuntimeTypeHandle[] targetTypeInstantiation, bool variantDispatch)
{
uint numTargetImplementations = entryParser.GetUnsigned();
for (uint j = 0; j < numTargetImplementations; j++)
{
uint nameAndSigToken = extRefs.GetRvaFromIndex(entryParser.GetUnsigned());
MethodNameAndSignature targetMethodNameAndSignature = GetMethodNameAndSignatureFromNativeReader(nativeLayoutReader, nameAndSigToken);
RuntimeTypeHandle targetTypeHandle = extRefs.GetRuntimeTypeHandleFromIndex(entryParser.GetUnsigned());
#if REFLECTION_EXECUTION_TRACE
ReflectionExecutionLogger.WriteLine(" Searching for GVM implementation on targe type = " + GetTypeNameDebug(targetTypeHandle));
#endif
uint numIfaceImpls = entryParser.GetUnsigned();
for (uint k = 0; k < numIfaceImpls; k++)
{
RuntimeTypeHandle implementingTypeHandle = extRefs.GetRuntimeTypeHandleFromIndex(entryParser.GetUnsigned());
uint numIfaceSigs = entryParser.GetUnsigned();
if (!openTargetTypeHandle.Equals(implementingTypeHandle))
{
// Skip over signatures data
for (uint l = 0; l < numIfaceSigs; l++)
entryParser.GetUnsigned();
continue;
}
for (uint l = 0; l < numIfaceSigs; l++)
{
RuntimeTypeHandle currentIfaceTypeHandle = default(RuntimeTypeHandle);
NativeParser ifaceSigParser = new NativeParser(nativeLayoutReader, extRefs.GetRvaFromIndex(entryParser.GetUnsigned()));
IntPtr currentIfaceSigPtr = ifaceSigParser.Reader.OffsetToAddress(ifaceSigParser.Offset);
if (TypeLoaderEnvironment.Instance.GetTypeFromSignatureAndContext(currentIfaceSigPtr, targetTypeInstantiation, null, out currentIfaceTypeHandle, out currentIfaceSigPtr))
{
Debug.Assert(!currentIfaceTypeHandle.IsNull());
if ((!variantDispatch && declaringType.Equals(currentIfaceTypeHandle)) ||
(variantDispatch && RuntimeAugments.IsAssignableFrom(declaringType, currentIfaceTypeHandle)))
{
#if REFLECTION_EXECUTION_TRACE
ReflectionExecutionLogger.WriteLine(" " + (declaringType.Equals(currentIfaceTypeHandle) ? "Exact" : "Variant-compatible") + " match found on this target type!");
#endif
// We found the GVM slot target for the input interface GVM call, so let's update the interface GVM slot and return success to the caller
declaringType = targetTypeHandle;
methodNameAndSignature = targetMethodNameAndSignature;
return true;
}
}
}
}
}
return false;
}