/// <summary>
        /// Gets the hash code of an assembly name
        /// </summary>
        /// <param name="a">Assembly name</param>
        /// <returns>The hash code</returns>
        public int GetHashCode(AssemblyNameInfo a)
        {
            if (a == null)
            {
                return(0);
            }

            int hash = 0;

            if (CompareName)
            {
                hash += UTF8String.GetHashCode(a.Name);
            }
            if (CompareVersion)
            {
                hash += Utils.CreateVersionWithNoUndefinedValues(a.Version).GetHashCode();
            }
            if (ComparePublicKeyToken)
            {
                hash += PublicKeyBase.GetHashCodeToken(a.PublicKeyOrToken);
            }
            if (CompareLocale)
            {
                hash += Utils.GetHashCodeLocale(a.Locale);
            }

            return(hash);
        }
예제 #2
0
        /// <summary>
        /// Gets the hash code of an assembly name
        /// </summary>
        /// <param name="a">Assembly name</param>
        /// <returns>The hash code</returns>
        public int GetHashCode(IAssembly a)
        {
            if (a == null)
            {
                return(0);
            }

            int hash = 0;

            if (CompareName)
            {
                hash += UTF8String.GetHashCode(a.Name);
            }
            if (CompareVersion)
            {
                hash += Utils.CreateVersionWithNoUndefinedValues(a.Version).GetHashCode();
            }
            if (ComparePublicKeyToken)
            {
                hash += PublicKeyBase.GetHashCodeToken(a.PublicKeyOrToken);
            }
            if (CompareCulture)
            {
                hash += Utils.GetHashCodeLocale(a.Culture);
            }
            if (CompareContentType)
            {
                hash += (int)a.ContentType;
            }

            return(hash);
        }
예제 #3
0
 public override int GetHashCode()
 {
     // Don't use IsValueType
     return(UTF8String.GetHashCode(Namespace) ^ UTF8String.GetHashCode(Name));
 }
예제 #4
0
 public override int GetHashCode() =>
 // Don't use IsValueType
 UTF8String.GetHashCode(Namespace) ^ UTF8String.GetHashCode(Name);