コード例 #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 (MeasurementUnit != null)
         {
             hashCode = hashCode * 59 + MeasurementUnit.GetHashCode();
         }
         if (Description != null)
         {
             hashCode = hashCode * 59 + Description.GetHashCode();
         }
         if (Modifier != null)
         {
             hashCode = hashCode * 59 + Modifier.GetHashCode();
         }
         if (GramWeight != null)
         {
             hashCode = hashCode * 59 + GramWeight.GetHashCode();
         }
         if (DataPoints != null)
         {
             hashCode = hashCode * 59 + DataPoints.GetHashCode();
         }
         if (Footnote != null)
         {
             hashCode = hashCode * 59 + Footnote.GetHashCode();
         }
         return(hashCode);
     }
 }
コード例 #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 (PctWeight != null)
         {
             hashCode = hashCode * 59 + PctWeight.GetHashCode();
         }
         if (GramWeight != null)
         {
             hashCode = hashCode * 59 + GramWeight.GetHashCode();
         }
         if (IsRefuse != null)
         {
             hashCode = hashCode * 59 + IsRefuse.GetHashCode();
         }
         if (DataPoints != null)
         {
             hashCode = hashCode * 59 + DataPoints.GetHashCode();
         }
         return(hashCode);
     }
 }
コード例 #3
0
        /// <summary>
        /// Returns true if IngredientObjectPortions instances are equal
        /// </summary>
        /// <param name="other">Instance of IngredientObjectPortions to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(IngredientObjectPortions other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     MeasurementUnit == other.MeasurementUnit ||
                     MeasurementUnit != null &&
                     MeasurementUnit.Equals(other.MeasurementUnit)
                     ) &&
                 (
                     Description == other.Description ||
                     Description != null &&
                     Description.Equals(other.Description)
                 ) &&
                 (
                     Modifier == other.Modifier ||
                     Modifier != null &&
                     Modifier.Equals(other.Modifier)
                 ) &&
                 (
                     GramWeight == other.GramWeight ||
                     GramWeight != null &&
                     GramWeight.Equals(other.GramWeight)
                 ) &&
                 (
                     DataPoints == other.DataPoints ||
                     DataPoints != null &&
                     DataPoints.Equals(other.DataPoints)
                 ) &&
                 (
                     Footnote == other.Footnote ||
                     Footnote != null &&
                     Footnote.Equals(other.Footnote)
                 ));
        }
コード例 #4
0
        /// <summary>
        /// Returns true if IngredientObjectComponents instances are equal
        /// </summary>
        /// <param name="other">Instance of IngredientObjectComponents to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(IngredientObjectComponents other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                     ) &&
                 (
                     PctWeight == other.PctWeight ||
                     PctWeight != null &&
                     PctWeight.Equals(other.PctWeight)
                 ) &&
                 (
                     GramWeight == other.GramWeight ||
                     GramWeight != null &&
                     GramWeight.Equals(other.GramWeight)
                 ) &&
                 (
                     IsRefuse == other.IsRefuse ||
                     IsRefuse != null &&
                     IsRefuse.Equals(other.IsRefuse)
                 ) &&
                 (
                     DataPoints == other.DataPoints ||
                     DataPoints != null &&
                     DataPoints.Equals(other.DataPoints)
                 ));
        }