/// <summary> /// Returns true if CreditCardInterest instances are equal /// </summary> /// <param name="other">Instance of CreditCardInterest to be compared</param> /// <returns>Boolean</returns> public bool Equals(CreditCardInterest other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( FeeRate == other.FeeRate || FeeRate != null && FeeRate.Equals(other.FeeRate) ) && ( InstalmentRate == other.InstalmentRate || InstalmentRate != null && InstalmentRate.Equals(other.InstalmentRate) ) && ( InterestRates == other.InterestRates || InterestRates != null && InterestRates.SequenceEqual(other.InterestRates) )); }
/// <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 (FeeRate != null) { hashCode = hashCode * 59 + FeeRate.GetHashCode(); } if (InstalmentRate != null) { hashCode = hashCode * 59 + InstalmentRate.GetHashCode(); } if (InterestRates != null) { hashCode = hashCode * 59 + InterestRates.GetHashCode(); } return(hashCode); } }