コード例 #1
0
        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");
        }
コード例 #2
0
        public static void Peel(Vegetable vegetable)
        {
            if (vegetable == null)
            {
                throw new ArgumentNullException("'vegetable' must be a 'Vegetable' object");
            }

            vegetable.IsPealed = true;
        }
コード例 #3
0
ファイル: Bowl.cs プロジェクト: antonpopov/HighQualityCode
        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);
        }