private int InitializeHashCode()
        {
            string ns = Namespace;
            var hashCodeBuilder = new TypeHashingAlgorithms.HashCodeBuilder(ns);
            if (ns.Length > 0)
                hashCodeBuilder.Append(".");
            hashCodeBuilder.Append(Name);
            _hashcode = hashCodeBuilder.ToHashCode();

            return _hashcode;
        }
        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?");
            }
        }
        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();
        }
        public static int ComputeHashCode(this TypeReferenceHandle typeRefHandle, MetadataReader reader)
        {
            HashCodeBuilder builder = new HashCodeBuilder("");

            TypeReference typeRef = reader.GetTypeReference(typeRefHandle);
            HandleType parentHandleType = typeRef.ParentNamespaceOrType.HandleType;
            bool isNested = parentHandleType == HandleType.TypeReference;
            if (!isNested)
            {
                Debug.Assert(parentHandleType == HandleType.NamespaceReference);
                AppendNamespaceHashCode(ref builder, typeRef.ParentNamespaceOrType.ToNamespaceReferenceHandle(reader), reader);
            }

            string typeName = reader.GetString(typeRef.TypeName);
            builder.Append(typeName);

            if (isNested)
            {
                int enclosingTypeHashCode = typeRef.ParentNamespaceOrType.ToTypeReferenceHandle(reader).ComputeHashCode(reader);
                return TypeHashingAlgorithms.ComputeNestedTypeHashCode(enclosingTypeHashCode, builder.ToHashCode());
            }

            return builder.ToHashCode();
        }