Пример #1
0
        public override int GetHashCode()
        {
            unchecked
            {
                // Choose large primes to avoid hashing collisions
                const int HashingBase       = (int)2166136261;
                const int HashingMultiplier = 16777619;

                int hash = HashingBase;
                hash = (hash * HashingMultiplier) ^ ByteProperty.GetHashCode();
                hash = (hash * HashingMultiplier) ^ ShortByteProperty.GetHashCode();
                hash = (hash * HashingMultiplier) ^ IntProperty.GetHashCode();
                hash = (hash * HashingMultiplier) ^ UIntProperty.GetHashCode();
                hash = (hash * HashingMultiplier) ^ ShortProperty.GetHashCode();
                hash = (hash * HashingMultiplier) ^ UShortProperty.GetHashCode();
                hash = (hash * HashingMultiplier) ^ LongProperty.GetHashCode();
                hash = (hash * HashingMultiplier) ^ ULongProperty.GetHashCode();
                hash = (hash * HashingMultiplier) ^ FloatPropertyOne.GetHashCode();
                hash = (hash * HashingMultiplier) ^ FloatPropertyTwo.GetHashCode();
                hash = (hash * HashingMultiplier) ^ DoublePropertyOne.GetHashCode();
                hash = (hash * HashingMultiplier) ^ DoublePropertyTwo.GetHashCode();
                hash = (hash * HashingMultiplier) ^ CharProperty.GetHashCode();
                hash = (hash * HashingMultiplier) ^ BoolProperty.GetHashCode();
                hash = (hash * HashingMultiplier) ^ DecimalProperty.GetHashCode();
                return(hash);
            }
        }
Пример #2
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = DateProperty.GetHashCode();
         hashCode = (hashCode * 397) ^ DateOffsetProperty.GetHashCode();
         hashCode = (hashCode * 397) ^ BoolProperty.GetHashCode();
         hashCode = (hashCode * 397) ^ IntProperty;
         hashCode = (hashCode * 397) ^ StringProperty.GetHashCode();
         return(hashCode);
     }
 }
Пример #3
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (StringProperty != null ? StringProperty.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ IntProperty;
         hashCode = (hashCode * 397) ^ BoolProperty.GetHashCode();
         hashCode = (hashCode * 397) ^ (ListOfSimpleTypes != null ? ListOfSimpleTypes.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (SimpleTypes != null ? SimpleTypes.GetHashCode() : 0);
         return(hashCode);
     }
 }