Exemplo n.º 1
0
        public static int GetHashCode(TypeReference type)
        {
            if (type == null)
            {
                return(0);
            }

            var hashCode =
                (type.DeclaringType == null ? 0 : type.DeclaringType.GetHashCode()) ^
                (type.Name.GetHashCode() << 3) ^
                (type.Namespace.GetHashCode() << 7) ^
                (type.etype.GetHashCode() << 11);

            if (type.IsGenericParameter)
            {
                hashCode ^= MetadataResolver.GetHashCodeHelper((GenericParameter)type);
            }
            else if (type.IsTypeSpecification())
            {
                hashCode ^= MetadataResolver.GetHashCodeHelper((TypeSpecification)type);
            }

            return(hashCode);
        }