/// <summary> /// Compare two <see cref="Address"/> objects for inequality. /// </summary> /// <param name="lhs">The left-hand side of the operation.</param> /// <param name="rhs">The right-hand side of the operation.</param> /// <returns> /// A value indicating whether or not the two <see cref="Address"/> objects are not equivalent. /// </returns> public static bool operator !=(Address lhs, Address rhs) { return(!NullSafeStringComparer.Equals(lhs?.City, rhs?.City) || !NullSafeStringComparer.Equals(lhs?.CountryCode, rhs?.CountryCode) || !NullSafeStringComparer.Equals(lhs?.PostalCode, rhs?.PostalCode) || !NullSafeStringComparer.Equals(lhs?.RegionCode, rhs?.RegionCode) || !NullSafeStringComparer.Equals(lhs?.Street, rhs?.Street)); }
/// <summary> /// Compare the current address with another for equality. /// </summary> /// <param name="other">An address to compare to the current address.</param> /// <returns> /// A value indicating whether or not the current address is equal to the given address. /// </returns> public virtual bool Equals(Address other) { return(NullSafeStringComparer.Equals(City, other?.City) && NullSafeStringComparer.Equals(CountryCode, other?.CountryCode) && NullSafeStringComparer.Equals(PostalCode, other?.PostalCode) && NullSafeStringComparer.Equals(RegionCode, other?.RegionCode) && NullSafeStringComparer.Equals(Street, other?.Street)); }
/// <summary> /// Get a value corresponding to the hash code for the current address. /// </summary> /// <returns>A hash code for the current address.</returns> public override int GetHashCode() => NullSafeStringComparer.GetHashCode(Components);