Ejemplo n.º 1
0
        public List <int> On_All(List <int> list, SquareOrCubeDelegate @delegate)
        {
            List <int> processedList = new List <int>();

            foreach (int item in list)
            {
                processedList.Add(@delegate(item));
            }
            return(processedList);
        }
Ejemplo n.º 2
0
        bool SetDelegateMethod()
        {
            int choise = AskChoise();

            switch (choise)
            {
            case 2: deleg = ReturnPowerOfTwo;
                return(true);

            case 3: deleg = ReturnPowerofThree;
                return(true);

            default: Console.WriteLine("You haven't chosen any method to process items in list. The exercise skipped");
                return(false);
            }
        }