コード例 #1
0
        public void DoFunc()
        {
            Func<int, int, int> addFunc = (x, y) => x + y;
            Func<int, int, int> multiplyFunc = (x, y) => x * y;

            var processData = new ProcessData();
            processData.ProcessFunc(10, 20, addFunc);
            processData.ProcessFunc(2, 5, multiplyFunc);
        }
コード例 #2
0
        public void DoAction()
        {
            Action<int, int> addAction = (x, y) => Console.WriteLine($"Result of Add Action {x + y}");
            Action<int, int> multiplyAction = (x, y) => Console.WriteLine($"Result of Multiply Action {x * y}");

            var process = new ProcessData();
            process.ProcessAction(10, 20, addAction);
            process.ProcessAction(2, 4, multiplyAction);
        }