/// <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); } }
/// <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) )); }
public override int GetHashCode() { unchecked { var result = FirstName?.GetHashCode() ?? 0; result = (result * 397) ^ (SurnamePrefix?.GetHashCode() ?? 0); result = (result * 397) ^ (Surname?.GetHashCode() ?? 0); return(result); } }
/// <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); } }
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(); } }
/// <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) )); }