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