Beispiel #1
0
        /// <summary>
        /// Return the HashCode of this object.
        /// </summary>
        /// <returns>The HashCode of this object.</returns>
        public override Int32 GetHashCode()
        {
            unchecked
            {
                return(Country.GetHashCode() * 19 ^
                       City.GetHashCode() * 17 ^
                       Street.GetHashCode() * 13 ^

                       (PostalCode.IsNotNullOrEmpty()
                            ? PostalCode.GetHashCode() * 11
                            : 0) ^

                       (HouseNumber.IsNotNullOrEmpty()
                            ? HouseNumber.GetHashCode() * 7
                            : 0) ^

                       (FloorLevel.IsNotNullOrEmpty()
                            ? FloorLevel.GetHashCode() * 5
                            : 0) ^

                       (Region.IsNotNullOrEmpty()
                            ? Region.GetHashCode() * 3
                            : 0) ^

                       (Timezone.IsNotNullOrEmpty()
                            ? Timezone.GetHashCode()
                            : 0));
            }
        }
Beispiel #2
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (City != null)
         {
             hashCode = hashCode * 59 + City.GetHashCode();
         }
         if (CountryCode != null)
         {
             hashCode = hashCode * 59 + CountryCode.GetHashCode();
         }
         if (HouseNumber != null)
         {
             hashCode = hashCode * 59 + HouseNumber.GetHashCode();
         }
         if (Street != null)
         {
             hashCode = hashCode * 59 + Street.GetHashCode();
         }
         if (Zip != null)
         {
             hashCode = hashCode * 59 + Zip.GetHashCode();
         }
         return(hashCode);
     }
 }
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (AdditionalAddressInfo != null)
         {
             hashCode = hashCode * 59 + AdditionalAddressInfo.GetHashCode();
         }
         if (City != null)
         {
             hashCode = hashCode * 59 + City.GetHashCode();
         }
         if (CountryCode != null)
         {
             hashCode = hashCode * 59 + CountryCode.GetHashCode();
         }
         if (FirstName != null)
         {
             hashCode = hashCode * 59 + FirstName.GetHashCode();
         }
         if (HouseNumber != null)
         {
             hashCode = hashCode * 59 + HouseNumber.GetHashCode();
         }
         if (State != null)
         {
             hashCode = hashCode * 59 + State.GetHashCode();
         }
         if (StateCode != null)
         {
             hashCode = hashCode * 59 + StateCode.GetHashCode();
         }
         if (Street != null)
         {
             hashCode = hashCode * 59 + Street.GetHashCode();
         }
         if (Surname != null)
         {
             hashCode = hashCode * 59 + Surname.GetHashCode();
         }
         if (SurnamePrefix != null)
         {
             hashCode = hashCode * 59 + SurnamePrefix.GetHashCode();
         }
         if (Zip != null)
         {
             hashCode = hashCode * 59 + Zip.GetHashCode();
         }
         return(hashCode);
     }
 }
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (AdditionalAddressInfo != null)
         {
             hashCode = hashCode * 59 + AdditionalAddressInfo.GetHashCode();
         }
         if (City != null)
         {
             hashCode = hashCode * 59 + City.GetHashCode();
         }
         if (CountryCode != null)
         {
             hashCode = hashCode * 59 + CountryCode.GetHashCode();
         }
         if (HouseNumber != null)
         {
             hashCode = hashCode * 59 + HouseNumber.GetHashCode();
         }
         if (Iban != null)
         {
             hashCode = hashCode * 59 + Iban.GetHashCode();
         }
         if (Id != null)
         {
             hashCode = hashCode * 59 + Id.GetHashCode();
         }
         if (Name != null)
         {
             hashCode = hashCode * 59 + Name.GetHashCode();
         }
         if (ReferenceParty != null)
         {
             hashCode = hashCode * 59 + ReferenceParty.GetHashCode();
         }
         if (ReferencePartyId != null)
         {
             hashCode = hashCode * 59 + ReferencePartyId.GetHashCode();
         }
         if (Street != null)
         {
             hashCode = hashCode * 59 + Street.GetHashCode();
         }
         if (Zip != null)
         {
             hashCode = hashCode * 59 + Zip.GetHashCode();
         }
         return(hashCode);
     }
 }
Beispiel #5
0
 /// <summary>
 ///     Serves as a hash function for a particular type.
 /// </summary>
 /// <returns>
 ///     A hash code for the current <see cref="T:System.Object" />.
 /// </returns>
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = Id;
         hashCode = (hashCode * 397) ^ (Street != null ? Street.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (HouseNumber != null ? HouseNumber.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (PostalCode != null ? PostalCode.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (City != null ? City.GetHashCode() : 0);
         return(hashCode);
     }
 }
Beispiel #6
0
 /// <summary>
 /// Return the HashCode of this object.
 /// </summary>
 /// <returns>The HashCode of this object.</returns>
 public override Int32 GetHashCode()
 {
     unchecked
     {
         return(Street.GetHashCode() * 17 ^
                HouseNumber.GetHashCode() * 13 ^
                FloorLevel.GetHashCode() * 11 ^
                PostalCode.GetHashCode() * 7 ^
                PostalCodeSub.GetHashCode() * 5 ^
                City.GetHashCode() * 3 ^
                Country.GetHashCode());
     }
 }
Beispiel #7
0
 public override int GetHashCode()
 {
     return(HouseNumber.GetHashCode() ^ StringComparer.OrdinalIgnoreCase.GetHashCode(StreetName));
 }
Beispiel #8
0
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                var hashCode = 41;
                // Suitable nullity checks etc, of course :)
                if (Name != null)
                {
                    hashCode = hashCode * 59 + Name.GetHashCode();
                }
                if (Label != null)
                {
                    hashCode = hashCode * 59 + Label.GetHashCode();
                }

                hashCode = hashCode * 59 + Score.GetHashCode();
                if (HouseNumber != null)
                {
                    hashCode = hashCode * 59 + HouseNumber.GetHashCode();
                }
                if (Street != null)
                {
                    hashCode = hashCode * 59 + Street.GetHashCode();
                }
                if (Region != null)
                {
                    hashCode = hashCode * 59 + Region.GetHashCode();
                }
                if (RegionCode != null)
                {
                    hashCode = hashCode * 59 + RegionCode.GetHashCode();
                }
                if (Neighbourhood != null)
                {
                    hashCode = hashCode * 59 + Neighbourhood.GetHashCode();
                }
                if (County != null)
                {
                    hashCode = hashCode * 59 + County.GetHashCode();
                }
                if (Macroregion != null)
                {
                    hashCode = hashCode * 59 + Macroregion.GetHashCode();
                }
                if (City != null)
                {
                    hashCode = hashCode * 59 + City.GetHashCode();
                }
                if (Country != null)
                {
                    hashCode = hashCode * 59 + Country.GetHashCode();
                }
                if (CountryCode != null)
                {
                    hashCode = hashCode * 59 + CountryCode.GetHashCode();
                }
                if (Continent != null)
                {
                    hashCode = hashCode * 59 + Continent.GetHashCode();
                }
                if (Postcode != null)
                {
                    hashCode = hashCode * 59 + Postcode.GetHashCode();
                }
                if (Features != null)
                {
                    hashCode = hashCode * 59 + Features.GetHashCode();
                }
                return(hashCode);
            }
        }
Beispiel #9
0
 public void GetHash_TestStruct_Hash()
 {
     Assert.AreEqual(123456789, TestStruct.GetHashCode());
 }