コード例 #1
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);
        }
コード例 #2
0
 public override int GetHashCode()
 {
     // Don't use IsValueType
     return(UTF8String.GetHashCode(Namespace) ^ UTF8String.GetHashCode(Name));
 }