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 (Calories != null)
         {
             hashCode = hashCode * 59 + Calories.GetHashCode();
         }
         if (DailyValues != null)
         {
             hashCode = hashCode * 59 + DailyValues.GetHashCode();
         }
         if (Fat != null)
         {
             hashCode = hashCode * 59 + Fat.GetHashCode();
         }
         if (Carbs != null)
         {
             hashCode = hashCode * 59 + Carbs.GetHashCode();
         }
         if (Vitamins != null)
         {
             hashCode = hashCode * 59 + Vitamins.GetHashCode();
         }
         return(hashCode);
     }
 }
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            // credit: http://stackoverflow.com/a/263416/677735
            unchecked // Overflow is fine, just wrap
            {
                var hash = 41;
                // Suitable nullity checks etc, of course :)

                if (Id != null)
                {
                    hash = hash * 59 + Id.GetHashCode();
                }

                if (EventType != null)
                {
                    hash = hash * 59 + EventType.GetHashCode();
                }

                if (CreatedAt != null)
                {
                    hash = hash * 59 + CreatedAt.GetHashCode();
                }

                if (Glucose != null)
                {
                    hash = hash * 59 + Glucose.GetHashCode();
                }

                if (GlucoseType != null)
                {
                    hash = hash * 59 + GlucoseType.GetHashCode();
                }

                if (Carbs != null)
                {
                    hash = hash * 59 + Carbs.GetHashCode();
                }

                if (Insulin != null)
                {
                    hash = hash * 59 + Insulin.GetHashCode();
                }

                if (Units != null)
                {
                    hash = hash * 59 + Units.GetHashCode();
                }

                if (Notes != null)
                {
                    hash = hash * 59 + Notes.GetHashCode();
                }

                if (EnteredBy != null)
                {
                    hash = hash * 59 + EnteredBy.GetHashCode();
                }

                return(hash);
            }
        }