示例#1
0
 public override int GetHashCode()
 {
     unchecked
     {
         return(((_comparer != null ? _comparer.GetHashCode() : 0) * 397) ^ (_keyComparer != null ? _keyComparer.GetHashCode() : 0));
     }
 }
示例#2
0
        /// <summary>
        /// Get the hashcode for the type collection and the comparer.  The type collection can be in any order.
        /// </summary>
        /// <param name="types"></param>
        /// <param name="comparer"></param>
        /// <returns></returns>
        public static int GetHashCode(Type[] types, IComparer <Entity> comparer = null)
        {
            var hashCode = 0;

            // Hashcode is build off the filters, independent of their order
            for (int i = 0; i < types.Length; i++)
            {
                hashCode += types[i].GetHashCode();
            }

            // Add on comparer hashcode if set - comparers should overload their
            // own GetHashCode to return a unique constant.
            hashCode += (comparer == null) ? 0 : comparer.GetHashCode();

            return(hashCode);
        }
示例#3
0
 public override int GetHashCode()
 {
     return(cmp.GetHashCode() ^ int.MinValue);
 }
示例#4
0
 public override int GetHashCode() => _comparer.GetHashCode() ^ _memberEqualityComparer.GetHashCode();
示例#5
0
 public override int GetHashCode()
 {
     return(keyComparer.GetHashCode());
 }
 public override int GetHashCode()
 {
     return(_comparer.GetHashCode() ^ _equalityComparer.GetHashCode());
 }
 public int GetHashCode(string str)
 {
     return(_baseCmp.GetHashCode(str ?? string.Empty));
 }
        /// <summary>
        /// Return the hash code for this comparator.
        /// </summary>
        /// <returns>
        /// The hash code value for this comparator.
        /// </returns>
        public override int GetHashCode()
        {
            IComparer comparer = m_comparer;

            return(comparer == null ? 17 : comparer.GetHashCode());
        }
示例#9
0
文件: Utils.cs 项目: xyuan/Dryad
 public override int GetHashCode()
 {
     // Modify the hash code so that it differs from the hash code for the underlying comparer.
     // It would also probably be good enough to just return _originalComparer.GetHashCode().
     return(unchecked ((_originalComparer.GetHashCode() + 123457) * 10007));
 }