Example #1
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>
 /// <filterpriority>2</filterpriority>
 public override int GetHashCode()
 {
     unchecked
     {
         var result = (SystemTransactionType != null ? SystemTransactionType.GetHashCode() : 0);
         result = (result * 397) ^ (StateProvince != null ? StateProvince.GetHashCode() : 0);
         result = (result * 397) ^ ReportingDate.GetHashCode();
         return(result);
     }
 }
Example #2
0
        public override int GetHashCode()
        {
            int result = street != null?street.GetHashCode() : 0;

            result = 31 * result + (city != null ? city.GetHashCode() : 0);
            result = 31 * result + (postalCode != null ? postalCode.GetHashCode() : 0);
            result = 31 * result + (country != null ? country.GetHashCode() : 0);
            result = 31 * result + (stateProvince != null ? stateProvince.GetHashCode() : 0);
            return(result);
        }
Example #3
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>
        /// <filterpriority>2</filterpriority>
        public override int GetHashCode()
        {
            unchecked
            {
                int result = FirstStreetAddress != null?FirstStreetAddress.GetHashCode() : 0;

                result = (result * 397) ^ (SecondStreetAddress != null ? SecondStreetAddress.GetHashCode() : 0);
                result = (result * 397) ^ (CityName != null ? CityName.GetHashCode() : 0);
                //result = (result * 397) ^ (CountyArea != null ? CountyArea.GetHashCode() : 0);
                result = (result * 397) ^ (StateProvince != null ? StateProvince.GetHashCode() : 0);
                //result = (result * 397) ^ (Country != null ? Country.GetHashCode() : 0);
                result = (result * 397) ^ (PostalCode != null ? PostalCode.GetHashCode() : 0);
                return(result);
            }
        }
#pragma warning disable CS1584 // XML comment has syntactically incorrect cref attribute
#pragma warning disable CS1658 // Warning is overriding an error

        /// <summary>
        /// Returns a hash code for this instance.
        /// </summary>
        /// <returns>
        /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
        /// </returns>
        /// <seealso cref="https://stackoverflow.com/questions/263400/what-is-the-best-algorithm-for-an-overridden-system-object-gethashcode/263416#263416"/>
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap.
            {
                int hash = 17;
                hash = hash * 23 + FirstName?.GetHashCode() ?? 0;
                hash = hash * 23 + LastName?.GetHashCode() ?? 0;
                hash = hash * 23 + Email?.GetHashCode() ?? 0;
                hash = hash * 23 + Country?.GetHashCode() ?? 0;
                hash = hash * 23 + StateProvince?.GetHashCode() ?? 0;
                hash = hash * 23 + City?.GetHashCode() ?? 0;
                hash = hash * 23 + Address1?.GetHashCode() ?? 0;
                hash = hash * 23 + Address2?.GetHashCode() ?? 0;
                hash = hash * 23 + PostalCode?.GetHashCode() ?? 0;
                hash = hash * 23 + PhoneNumber?.GetHashCode() ?? 0;
                return(hash);
            }
        }