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(); }
} // Offset public TypeDefinition GetTypeDefinition(MetadataReader reader) { return reader.GetTypeDefinition(this); } // GetTypeDefinition