/// <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); } }
/// <summary> /// Returns true if IngredientObjectItems instances are equal /// </summary> /// <param name="other">Instance of IngredientObjectItems to be compared</param> /// <returns>Boolean</returns> public bool Equals(IngredientObjectItems other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Name == other.Name || Name != null && Name.Equals(other.Name) ) && ( Categories == other.Categories || Categories != null && Categories.SequenceEqual(other.Categories) ) && ( Nutrients == other.Nutrients || Nutrients != null && Nutrients.SequenceEqual(other.Nutrients) ) && ( CalorieConversionFactor == other.CalorieConversionFactor || CalorieConversionFactor != null && CalorieConversionFactor.Equals(other.CalorieConversionFactor) ) && ( ProteinConversionFactor == other.ProteinConversionFactor || ProteinConversionFactor != null && ProteinConversionFactor.Equals(other.ProteinConversionFactor) ) && ( Components == other.Components || Components != null && Components.SequenceEqual(other.Components) ) && ( Portions == other.Portions || Portions != null && Portions.SequenceEqual(other.Portions) ) && ( CommonName == other.CommonName || CommonName != null && CommonName.Equals(other.CommonName) ) && ( Footnote == other.Footnote || Footnote != null && Footnote.Equals(other.Footnote) ) && ( SearchTerm == other.SearchTerm || SearchTerm != null && SearchTerm.Equals(other.SearchTerm) ) && ( Score == other.Score || Score != null && Score.Equals(other.Score) )); }