Example #1
0
        /// <summary>
        /// Returns true if BrandedFoodObjectDietFlags instances are equal
        /// </summary>
        /// <param name="other">Instance of BrandedFoodObjectDietFlags to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(BrandedFoodObjectDietFlags other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Ingredient == other.Ingredient ||
                     Ingredient != null &&
                     Ingredient.Equals(other.Ingredient)
                     ) &&
                 (
                     IngredientDescription == other.IngredientDescription ||
                     IngredientDescription != null &&
                     IngredientDescription.Equals(other.IngredientDescription)
                 ) &&
                 (
                     DietLabel == other.DietLabel ||
                     DietLabel != null &&
                     DietLabel.Equals(other.DietLabel)
                 ) &&
                 (
                     IsCompatible == other.IsCompatible ||
                     IsCompatible != null &&
                     IsCompatible.Equals(other.IsCompatible)
                 ) &&
                 (
                     CompatibilityLevel == other.CompatibilityLevel ||
                     CompatibilityLevel != null &&
                     CompatibilityLevel.Equals(other.CompatibilityLevel)
                 ) &&
                 (
                     CompatibilityDescription == other.CompatibilityDescription ||
                     CompatibilityDescription != null &&
                     CompatibilityDescription.Equals(other.CompatibilityDescription)
                 ) &&
                 (
                     IsAllergen == other.IsAllergen ||
                     IsAllergen != null &&
                     IsAllergen.Equals(other.IsAllergen)
                 ));
        }
Example #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 (Ingredient != null)
         {
             hashCode = hashCode * 59 + Ingredient.GetHashCode();
         }
         if (IngredientDescription != null)
         {
             hashCode = hashCode * 59 + IngredientDescription.GetHashCode();
         }
         if (DietLabel != null)
         {
             hashCode = hashCode * 59 + DietLabel.GetHashCode();
         }
         if (IsCompatible != null)
         {
             hashCode = hashCode * 59 + IsCompatible.GetHashCode();
         }
         if (CompatibilityLevel != null)
         {
             hashCode = hashCode * 59 + CompatibilityLevel.GetHashCode();
         }
         if (CompatibilityDescription != null)
         {
             hashCode = hashCode * 59 + CompatibilityDescription.GetHashCode();
         }
         if (IsAllergen != null)
         {
             hashCode = hashCode * 59 + IsAllergen.GetHashCode();
         }
         return(hashCode);
     }
 }