public void AddCandy(Candies candyItem) { if (candyItem == null) { throw new ArgumentNullException("ERROR: The object is empty. Please specify candy parameters"); } insideBox.Add(candyItem); }
public void DeleteCandy(Candies candyItem) { if (insideBox.Count == 0) { throw new Exception("It is impossible to remove item from the box. The box is empty"); } if (insideBox.Contains(candyItem)) { insideBox.Remove(candyItem); } else { throw new ArgumentException("ERROR: Item is absent in the box"); } }