Example #1
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 (Name != null)
         {
             hashCode = hashCode * 59 + Name.GetHashCode();
         }
         if (Categories != null)
         {
             hashCode = hashCode * 59 + Categories.GetHashCode();
         }
         if (Nutrients != null)
         {
             hashCode = hashCode * 59 + Nutrients.GetHashCode();
         }
         if (CalorieConversionFactor != null)
         {
             hashCode = hashCode * 59 + CalorieConversionFactor.GetHashCode();
         }
         if (ProteinConversionFactor != null)
         {
             hashCode = hashCode * 59 + ProteinConversionFactor.GetHashCode();
         }
         if (Components != null)
         {
             hashCode = hashCode * 59 + Components.GetHashCode();
         }
         if (Portions != null)
         {
             hashCode = hashCode * 59 + Portions.GetHashCode();
         }
         if (CommonName != null)
         {
             hashCode = hashCode * 59 + CommonName.GetHashCode();
         }
         if (Footnote != null)
         {
             hashCode = hashCode * 59 + Footnote.GetHashCode();
         }
         if (SearchTerm != null)
         {
             hashCode = hashCode * 59 + SearchTerm.GetHashCode();
         }
         if (Score != null)
         {
             hashCode = hashCode * 59 + Score.GetHashCode();
         }
         return(hashCode);
     }
 }