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

            return
                ((
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                     ) &&
                 (
                     ImgUrl == other.ImgUrl ||
                     ImgUrl != null &&
                     ImgUrl.Equals(other.ImgUrl)
                 ) &&
                 (
                     University == other.University ||
                     University != null &&
                     University.Equals(other.University)
                 ));
        }
Пример #2
0
 public override bool Equals(System.Object otherCake)
 {
     if (!(otherCake is Cupcake))
     {
         return(false);
     }
     else
     {
         Cupcake newCupcake          = (Cupcake)otherCake;
         bool    IdEquality          = Id.Equals(newCupcake.Id);
         bool    NameEquality        = Name.Equals(newCupcake.Name);
         bool    DescriptionEquality = Description.Equals(newCupcake.Description);
         bool    PriceEquality       = Price.Equals(newCupcake.Price);
         bool    CakeEquality        = Cake.Equals(newCupcake.Cake);
         bool    FrostingEquality    = Frosting.Equals(newCupcake.Frosting);
         bool    ToppingEquality     = Topping.Equals(newCupcake.Topping);
         bool    InventoryEquality   = Inventory.Equals(newCupcake.Inventory);
         bool    ImgUrlEquality      = ImgUrl.Equals(newCupcake.ImgUrl);
         return(IdEquality && NameEquality && DescriptionEquality && PriceEquality && CakeEquality && FrostingEquality && ToppingEquality && InventoryEquality && ImgUrlEquality);
     }
 }