Esempio n. 1
0
 public static void Menu(this FoodCollection <string> menu)
 {
     Console.WriteLine("OUR MENU");
     for (int i = 0; i < menu.FoodAmount(); i++)
     {
         Console.WriteLine(menu.Meals[i]);
     }
 }
Esempio n. 2
0
        // Using "Clean code" rule
        // Исполнение лишь одной операции в функции
        private FoodCollection <string> addFoodToRation()
        {
            FoodCollection <string> ration = new   FoodCollection <string>();

            ration.AddDish(Racion.bread.ToString());
            ration.AddDish((Racion.salt.ToString()));
            ration.AddDish(Racion.water.ToString());
            return(ration);
        }
Esempio n. 3
0
        public void Ration()
        {
            FoodCollection <string> ration = addFoodToRation();
            Action <int, string[]>  action = delegate(int foodAmount, string [] meals)
            {
                for (int i = 0; i < foodAmount; i++)
                {
                    Console.WriteLine(meals[i]);
                }
            };

            action(ration.FoodAmount(), ration.Meals);
        }