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

            return
                ((
                     Vegan == other.Vegan ||
                     Vegan != null &&
                     Vegan.Equals(other.Vegan)
                     ) &&
                 (
                     Vegetarian == other.Vegetarian ||
                     Vegetarian != null &&
                     Vegetarian.Equals(other.Vegetarian)
                 ) &&
                 (
                     GlutenFree == other.GlutenFree ||
                     GlutenFree != null &&
                     GlutenFree.Equals(other.GlutenFree)
                 ));
        }
예제 #2
0
        public static List <Vegan> Parsetime(Stream vegandata)
        {
            XmlReader tidedoc = XmlReader.Create(vegandata);

            var isVegan = new List <Vegan>();

            Console.WriteLine(vegandata);
            using (tidedoc)
            {
                Vegan tide = null;

                while (tidedoc.Read())
                {
                    if (tidedoc.IsStartElement())
                    {
                        switch (tidedoc.Name)
                        {
                        case "item":
                            /*  tide = new Vegan();
                             * break;
                             * case "time":
                             * if (tidedoc.Read() && tide != null)
                             * {
                             *    tide.Time = tidedoc.Value.Trim();
                             *    Console.WriteLine(tide.Time);
                             * }
                             * break;
                             *
                             * case "pred":
                             * if (tidedoc.Read() && tide != null)
                             * {
                             *    tide.Feet = tidedoc.Value.Trim();
                             *    Console.WriteLine(tide.Feet + "ft");
                             * }
                             * break;
                             * case "type":
                             * if (tidedoc.Read() && tide != null)
                             * {
                             *    tide.HiLo = tidedoc.Value.Trim();
                             *    Console.WriteLine(tide.HiLo);
                             * }*/
                            break;
                        }
                    }
                }
            }


            return(isVegan);
        }
 /// <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 (Vegan != null)
         {
             hashCode = hashCode * 59 + Vegan.GetHashCode();
         }
         if (Vegetarian != null)
         {
             hashCode = hashCode * 59 + Vegetarian.GetHashCode();
         }
         if (GlutenFree != null)
         {
             hashCode = hashCode * 59 + GlutenFree.GetHashCode();
         }
         return(hashCode);
     }
 }