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