예제 #1
0
 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);
     }
 }
예제 #2
0
 /// <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);
     }
 }