本文整理汇总了C#中Internal.Metadata.NativeFormat.MetadataReader.GetString方法的典型用法代码示例。如果您正苦于以下问题:C# MetadataReader.GetString方法的具体用法?C# MetadataReader.GetString怎么用?C# MetadataReader.GetString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Internal.Metadata.NativeFormat.MetadataReader
的用法示例。
在下文中一共展示了MetadataReader.GetString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AppendNamespaceHashCode
private static void AppendNamespaceHashCode(ref HashCodeBuilder builder, NamespaceReferenceHandle namespaceRefHandle, MetadataReader reader)
{
NamespaceReference namespaceReference = reader.GetNamespaceReference(namespaceRefHandle);
Handle parentHandle = namespaceReference.ParentScopeOrNamespace;
HandleType parentHandleType = parentHandle.HandleType;
if (parentHandleType == HandleType.NamespaceReference)
{
AppendNamespaceHashCode(ref builder, parentHandle.ToNamespaceReferenceHandle(reader), reader);
string namespaceNamePart = reader.GetString(namespaceReference.Name);
builder.Append(namespaceNamePart);
builder.Append(".");
}
else
{
Debug.Assert(parentHandleType == HandleType.ScopeReference);
Debug.Assert(String.IsNullOrEmpty(reader.GetString(namespaceReference.Name)), "Root namespace with a name?");
}
}
示例2: ComputeHashCode
public static int ComputeHashCode(this TypeDefinitionHandle typeDefHandle, MetadataReader reader)
{
HashCodeBuilder builder = new HashCodeBuilder("");
TypeDefinition typeDef = reader.GetTypeDefinition(typeDefHandle);
bool isNested = typeDef.Flags.IsNested();
if (!isNested)
{
AppendNamespaceHashCode(ref builder, typeDef.NamespaceDefinition, reader);
}
string typeName = reader.GetString(typeDef.Name);
builder.Append(typeName);
if (isNested)
{
int enclosingTypeHashCode = typeDef.EnclosingType.ComputeHashCode(reader);
return TypeHashingAlgorithms.ComputeNestedTypeHashCode(enclosingTypeHashCode, builder.ToHashCode());
}
return builder.ToHashCode();
}
示例3: TryGetFieldAccessMetadataFromNativeFormatMetadata
/// <summary>
/// Try to figure out field access information based on type metadata for native format types.
/// </summary>
/// <param name="metadataReader">Metadata reader for the declaring type</param>
/// <param name="declaringTypeHandle">Declaring type for the method</param>
/// <param name="fieldHandle">Field handle</param>
/// <param name="canonFormKind">Canonical form to use</param>
/// <param name="fieldAccessMetadata">Output - metadata information for field accessor construction</param>
/// <returns>true when found, false otherwise</returns>
private static bool TryGetFieldAccessMetadataFromNativeFormatMetadata(
MetadataReader metadataReader,
RuntimeTypeHandle declaringTypeHandle,
FieldHandle fieldHandle,
TypeSystemContext context,
ref FieldAccessMetadata fieldAccessMetadata)
{
Field field = metadataReader.GetField(fieldHandle);
string fieldName = metadataReader.GetString(field.Name);
TypeDesc declaringType = context.ResolveRuntimeTypeHandle(declaringTypeHandle);
#if SUPPORTS_NATIVE_METADATA_TYPE_LOADING
if (declaringType is MetadataType)
{
return TryGetFieldAccessMetadataForNativeFormatType(declaringType, fieldName, ref fieldAccessMetadata);
}
#endif
return false;
}