/// <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 (Model != null) { hashCode = hashCode * 59 + Model.GetHashCode(); } if (Year != null) { hashCode = hashCode * 59 + Year.GetHashCode(); } if (Price != null) { hashCode = hashCode * 59 + Price.GetHashCode(); } if (SerialNumber != null) { hashCode = hashCode * 59 + SerialNumber.GetHashCode(); } if (SoldDateUtc != null) { hashCode = hashCode * 59 + SoldDateUtc.GetHashCode(); } if (Comment != null) { hashCode = hashCode * 59 + Comment.GetHashCode(); } if (Transmission != null) { hashCode = hashCode * 59 + Transmission.GetHashCode(); } if (Motor != null) { hashCode = hashCode * 59 + Motor.GetHashCode(); } if (GarageId != null) { hashCode = hashCode * 59 + GarageId.GetHashCode(); } if (SellerId != null) { hashCode = hashCode * 59 + SellerId.GetHashCode(); } return(hashCode); } }
/// <summary> /// Returns true if CarInfo instances are equal /// </summary> /// <param name="other">Instance of CarInfo to be compared</param> /// <returns>Boolean</returns> public bool Equals(CarInfo other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Model == other.Model || Model != null && Model.Equals(other.Model) ) && ( Year == other.Year || Year != null && Year.Equals(other.Year) ) && ( Price == other.Price || Price != null && Price.Equals(other.Price) ) && ( SerialNumber == other.SerialNumber || SerialNumber != null && SerialNumber.Equals(other.SerialNumber) ) && ( SoldDateUtc == other.SoldDateUtc || SoldDateUtc != null && SoldDateUtc.Equals(other.SoldDateUtc) ) && ( Comment == other.Comment || Comment != null && Comment.Equals(other.Comment) ) && ( Transmission == other.Transmission || Transmission != null && Transmission.Equals(other.Transmission) ) && ( Motor == other.Motor || Motor != null && Motor.Equals(other.Motor) ) && ( GarageId == other.GarageId || GarageId != null && GarageId.Equals(other.GarageId) ) && ( SellerId == other.SellerId || SellerId != null && SellerId.Equals(other.SellerId) )); }