Ejemplo n.º 1
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 (FirstName != null)
         {
             hashCode = hashCode * 59 + FirstName.GetHashCode();
         }
         if (Surname != null)
         {
             hashCode = hashCode * 59 + Surname.GetHashCode();
         }
         if (SurnamePrefix != null)
         {
             hashCode = hashCode * 59 + SurnamePrefix.GetHashCode();
         }
         if (Title != null)
         {
             hashCode = hashCode * 59 + Title.GetHashCode();
         }
         return(hashCode);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns true if AirlinePassenger instances are equal
        /// </summary>
        /// <param name="other">Instance of AirlinePassenger to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(AirlinePassenger other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     FirstName == other.FirstName ||
                     FirstName != null &&
                     FirstName.Equals(other.FirstName)
                     ) &&
                 (
                     Surname == other.Surname ||
                     Surname != null &&
                     Surname.Equals(other.Surname)
                 ) &&
                 (
                     SurnamePrefix == other.SurnamePrefix ||
                     SurnamePrefix != null &&
                     SurnamePrefix.Equals(other.SurnamePrefix)
                 ) &&
                 (
                     Title == other.Title ||
                     Title != null &&
                     Title.Equals(other.Title)
                 ));
        }
Ejemplo n.º 3
0
 public override int GetHashCode()
 {
     unchecked
     {
         var result = FirstName?.GetHashCode() ?? 0;
         result = (result * 397) ^ (SurnamePrefix?.GetHashCode() ?? 0);
         result = (result * 397) ^ (Surname?.GetHashCode() ?? 0);
         return(result);
     }
 }
Ejemplo n.º 4
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 (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);
     }
 }
Ejemplo n.º 5
0
 public void SetDefaultCasing()
 {
     if (Initials != null)
     {
         Initials = Initials.ToUpper();
     }
     if (FirstName != null)
     {
         FirstName = FirstName.ToInvariantTitleCase();
     }
     if (SurnamePrefix != null)
     {
         SurnamePrefix = SurnamePrefix.ToLower();
     }
     if (Surname != null)
     {
         Surname = Surname.ToInvariantTitleCase();
     }
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Returns true if Debtor instances are equal
        /// </summary>
        /// <param name="other">Instance of Debtor to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Debtor other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     AdditionalAddressInfo == other.AdditionalAddressInfo ||
                     AdditionalAddressInfo != null &&
                     AdditionalAddressInfo.Equals(other.AdditionalAddressInfo)
                     ) &&
                 (
                     City == other.City ||
                     City != null &&
                     City.Equals(other.City)
                 ) &&
                 (
                     CountryCode == other.CountryCode ||
                     CountryCode != null &&
                     CountryCode.Equals(other.CountryCode)
                 ) &&
                 (
                     FirstName == other.FirstName ||
                     FirstName != null &&
                     FirstName.Equals(other.FirstName)
                 ) &&
                 (
                     HouseNumber == other.HouseNumber ||
                     HouseNumber != null &&
                     HouseNumber.Equals(other.HouseNumber)
                 ) &&
                 (
                     State == other.State ||
                     State != null &&
                     State.Equals(other.State)
                 ) &&
                 (
                     StateCode == other.StateCode ||
                     StateCode != null &&
                     StateCode.Equals(other.StateCode)
                 ) &&
                 (
                     Street == other.Street ||
                     Street != null &&
                     Street.Equals(other.Street)
                 ) &&
                 (
                     Surname == other.Surname ||
                     Surname != null &&
                     Surname.Equals(other.Surname)
                 ) &&
                 (
                     SurnamePrefix == other.SurnamePrefix ||
                     SurnamePrefix != null &&
                     SurnamePrefix.Equals(other.SurnamePrefix)
                 ) &&
                 (
                     Zip == other.Zip ||
                     Zip != null &&
                     Zip.Equals(other.Zip)
                 ));
        }