private static void Cook(Vegetable vegetable)
        {
            if (vegetable == null)
            {
                throw new ArgumentNullException("Cannot pass null to 'Cook'");
            }

            Console.WriteLine(vegetable.GetType().Name + " is being prepared");
        }
        public static void Peel(Vegetable vegetable)
        {
            if (vegetable == null)
            {
                throw new ArgumentNullException("'vegetable' must be a 'Vegetable' object");
            }

            vegetable.IsPealed = true;
        }
Exemple #3
0
        public void AddVegetable(Vegetable vegetable)
        {
            if (vegetable == null)
            {
                throw new ArgumentNullException("Added vegetable cannot be null. It should be of type 'Vegetable'.");
            }

            this.vegetablesList.Add(vegetable);
        }