示例#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 (Per100g != null)
         {
             hashCode = hashCode * 59 + Per100g.GetHashCode();
         }
         if (MeasurementUnit != null)
         {
             hashCode = hashCode * 59 + MeasurementUnit.GetHashCode();
         }
         if (Rank != null)
         {
             hashCode = hashCode * 59 + Rank.GetHashCode();
         }
         if (DataPoints != null)
         {
             hashCode = hashCode * 59 + DataPoints.GetHashCode();
         }
         if (Description != null)
         {
             hashCode = hashCode * 59 + Description.GetHashCode();
         }
         return(hashCode);
     }
 }
示例#2
0
        /// <summary>
        /// Returns true if BrandedFoodObjectNutrients instances are equal
        /// </summary>
        /// <param name="other">Instance of BrandedFoodObjectNutrients to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(BrandedFoodObjectNutrients other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                     ) &&
                 (
                     Per100g == other.Per100g ||
                     Per100g != null &&
                     Per100g.Equals(other.Per100g)
                 ) &&
                 (
                     MeasurementUnit == other.MeasurementUnit ||
                     MeasurementUnit != null &&
                     MeasurementUnit.Equals(other.MeasurementUnit)
                 ) &&
                 (
                     Rank == other.Rank ||
                     Rank != null &&
                     Rank.Equals(other.Rank)
                 ) &&
                 (
                     DataPoints == other.DataPoints ||
                     DataPoints != null &&
                     DataPoints.Equals(other.DataPoints)
                 ) &&
                 (
                     Description == other.Description ||
                     Description != null &&
                     Description.Equals(other.Description)
                 ));
        }
示例#3
0
        /// <summary>
        /// Returns true if IngredientObjectNutrients instances are equal
        /// </summary>
        /// <param name="other">Instance of IngredientObjectNutrients to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(IngredientObjectNutrients other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                     ) &&
                 (
                     Per100g == other.Per100g ||
                     Per100g != null &&
                     Per100g.Equals(other.Per100g)
                 ) &&
                 (
                     MeasurementUnit == other.MeasurementUnit ||
                     MeasurementUnit != null &&
                     MeasurementUnit.Equals(other.MeasurementUnit)
                 ) &&
                 (
                     Min == other.Min ||
                     Min != null &&
                     Min.Equals(other.Min)
                 ) &&
                 (
                     Max == other.Max ||
                     Max != null &&
                     Max.Equals(other.Max)
                 ) &&
                 (
                     Median == other.Median ||
                     Median != null &&
                     Median.Equals(other.Median)
                 ) &&
                 (
                     Rank == other.Rank ||
                     Rank != null &&
                     Rank.Equals(other.Rank)
                 ) &&
                 (
                     DataPoints == other.DataPoints ||
                     DataPoints != null &&
                     DataPoints.Equals(other.DataPoints)
                 ) &&
                 (
                     Footnote == other.Footnote ||
                     Footnote != null &&
                     Footnote.Equals(other.Footnote)
                 ) &&
                 (
                     Description == other.Description ||
                     Description != null &&
                     Description.Equals(other.Description)
                 ));
        }