本文整理汇总了C#中System.RuntimeTypeHandle.GetHashCode方法的典型用法代码示例。如果您正苦于以下问题:C# RuntimeTypeHandle.GetHashCode方法的具体用法?C# RuntimeTypeHandle.GetHashCode怎么用?C# RuntimeTypeHandle.GetHashCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.RuntimeTypeHandle
的用法示例。
在下文中一共展示了RuntimeTypeHandle.GetHashCode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetRuntimeTypeHandleUnsafe
/// <summary>
/// Setter for RuntimeTypeHandle. Seperate from normal property as all uses should be done with great care.
/// Must not be set with partially constructed type handles
/// </summary>
public void SetRuntimeTypeHandleUnsafe(RuntimeTypeHandle runtimeTypeHandle)
{
Debug.Assert(!runtimeTypeHandle.IsNull());
Debug.Assert(_runtimeTypeHandle.IsNull() || runtimeTypeHandle.Equals(_runtimeTypeHandle));
Debug.Assert(runtimeTypeHandle.GetHashCode() == GetHashCode());
_runtimeTypeHandle = runtimeTypeHandle;
}
示例2: TryGetMetadataForNamedType
public unsafe bool TryGetMetadataForNamedType(RuntimeTypeHandle runtimeTypeHandle, out MetadataReader metadataReader, out TypeDefinitionHandle typeDefHandle)
{
// Iterate over all modules, starting with the module that defines the EEType
foreach (IntPtr moduleHandle in ModuleList.Enumerate(RuntimeAugments.GetModuleFromTypeHandle(runtimeTypeHandle)))
{
NativeReader typeMapReader;
if (TryGetNativeReaderForBlob(moduleHandle, ReflectionMapBlob.TypeMap, out typeMapReader))
{
NativeParser typeMapParser = new NativeParser(typeMapReader, 0);
NativeHashtable typeHashtable = new NativeHashtable(typeMapParser);
ExternalReferencesTable externalReferences = default(ExternalReferencesTable);
externalReferences.InitializeCommonFixupsTable(moduleHandle);
var lookup = typeHashtable.Lookup(runtimeTypeHandle.GetHashCode());
NativeParser entryParser;
while (!(entryParser = lookup.GetNext()).IsNull)
{
RuntimeTypeHandle foundType = externalReferences.GetRuntimeTypeHandleFromIndex(entryParser.GetUnsigned());
if (foundType.Equals(runtimeTypeHandle))
{
Handle entryMetadataHandle = entryParser.GetUnsigned().AsHandle();
if (entryMetadataHandle.HandleType == HandleType.TypeDefinition)
{
metadataReader = ModuleList.Instance.GetMetadataReaderForModule(moduleHandle);
typeDefHandle = entryMetadataHandle.ToTypeDefinitionHandle(metadataReader);
return true;
}
}
}
}
}
metadataReader = null;
typeDefHandle = default(TypeDefinitionHandle);
return false;
}
示例3: GetStaticInfo
private NativeParser GetStaticInfo(RuntimeTypeHandle instantiatedType, out ExternalReferencesTable staticsInfoLookup)
{
IntPtr moduleHandle = RuntimeAugments.GetModuleFromTypeHandle(instantiatedType);
NativeHashtable staticsInfoHashtable;
ExternalReferencesTable externalReferencesLookup;
if (!GetStaticsInfoHashtable(moduleHandle, out staticsInfoHashtable, out externalReferencesLookup, out staticsInfoLookup))
return new NativeParser();
int lookupHashcode = instantiatedType.GetHashCode();
var enumerator = staticsInfoHashtable.Lookup(lookupHashcode);
NativeParser entryParser;
while (!(entryParser = enumerator.GetNext()).IsNull)
{
RuntimeTypeHandle parsedInstantiatedType = externalReferencesLookup.GetRuntimeTypeHandleFromIndex(entryParser.GetUnsigned());
if (!parsedInstantiatedType.Equals(instantiatedType))
continue;
return entryParser;
}
return new NativeParser();
}
示例4: Lookup
internal int Lookup(RuntimeTypeHandle handle)
{
for (int slot = GetFirst(handle.GetHashCode()); slot >= 0; slot = GetNext(slot))
{
int index = GetIndex(slot);
if (handle.Equals(m_getHandle(index)))
{
return index;
}
}
return -1;
}