public override int GetHashCode() { unchecked { int hash = 17; hash = hash * 23 + (Comments == null ? 0 : Comments.GetHashCode()); hash = hash * 23 + (EmailAddress == null ? 0 : EmailAddress.GetHashCode()); hash = hash * 23 + (ModifiedDate == default(DateTime) ? 0 : ModifiedDate.GetHashCode()); hash = hash * 23 + (ProductId == default(int) ? 0 : ProductId.GetHashCode()); hash = hash * 23 + (Rating == default(int) ? 0 : Rating.GetHashCode()); hash = hash * 23 + (ReviewDate == default(DateTime) ? 0 : ReviewDate.GetHashCode()); hash = hash * 23 + (ReviewerName == null ? 0 : ReviewerName.GetHashCode()); return(hash); } }
/// <summary> /// Returns true if ProductReview instances are equal /// </summary> /// <param name="other">Instance of ProductReview to be compared</param> /// <returns>Boolean</returns> public bool Equals(ProductReview other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( ProductReviewID == other.ProductReviewID || ProductReviewID != null && ProductReviewID.Equals(other.ProductReviewID) ) && ( ProductId == other.ProductId || ProductId != null && ProductId.Equals(other.ProductId) ) && ( ReviewerName == other.ReviewerName || ReviewerName != null && ReviewerName.Equals(other.ReviewerName) ) && ( ReviewDate == other.ReviewDate || ReviewDate != null && ReviewDate.Equals(other.ReviewDate) ) && ( EmailAddress == other.EmailAddress || EmailAddress != null && EmailAddress.Equals(other.EmailAddress) ) && ( Rating == other.Rating || Rating != null && Rating.Equals(other.Rating) ) && ( Comments == other.Comments || Comments != null && Comments.Equals(other.Comments) )); }
/// <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 (ProductReviewID != null) { hashCode = hashCode * 59 + ProductReviewID.GetHashCode(); } if (ProductId != null) { hashCode = hashCode * 59 + ProductId.GetHashCode(); } if (ReviewerName != null) { hashCode = hashCode * 59 + ReviewerName.GetHashCode(); } if (ReviewDate != null) { hashCode = hashCode * 59 + ReviewDate.GetHashCode(); } if (EmailAddress != null) { hashCode = hashCode * 59 + EmailAddress.GetHashCode(); } if (Rating != null) { hashCode = hashCode * 59 + Rating.GetHashCode(); } if (Comments != null) { hashCode = hashCode * 59 + Comments.GetHashCode(); } return(hashCode); } }