Beispiel #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);
     }
 }
Beispiel #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 (Name != null)
         {
             hashCode = hashCode * 59 + Name.GetHashCode();
         }
         if (Per100g != null)
         {
             hashCode = hashCode * 59 + Per100g.GetHashCode();
         }
         if (MeasurementUnit != null)
         {
             hashCode = hashCode * 59 + MeasurementUnit.GetHashCode();
         }
         if (Min != null)
         {
             hashCode = hashCode * 59 + Min.GetHashCode();
         }
         if (Max != null)
         {
             hashCode = hashCode * 59 + Max.GetHashCode();
         }
         if (Median != null)
         {
             hashCode = hashCode * 59 + Median.GetHashCode();
         }
         if (Rank != null)
         {
             hashCode = hashCode * 59 + Rank.GetHashCode();
         }
         if (DataPoints != null)
         {
             hashCode = hashCode * 59 + DataPoints.GetHashCode();
         }
         if (Footnote != null)
         {
             hashCode = hashCode * 59 + Footnote.GetHashCode();
         }
         if (Description != null)
         {
             hashCode = hashCode * 59 + Description.GetHashCode();
         }
         return(hashCode);
     }
 }