.net 自带的两个内置委托

            #region Action与Func内置委托
 
 
            //--------------无返回值的委托---------------------------
            //1.无参数,无返回值的委托
            Action action = () => { Console.WriteLine("无参数,没有返回值!"); };
            action();
 
            //2.带参数,无返回值的委托
            Action<int, int> action = (x, y) => { Console.WriteLine(x + y); };
            action(100, 100);
            Console.Read();
 
 
            //--------------有返回值的委托----------------------------
            //1.无参数,有返回值的委托
            Func<int> func = () => { return 100; };
            int r = func();
            Console.WriteLine(r);
            Console.Read();
 
            //2.带参数,有返回值的委托
            Func<int, int, int, int, int> func = (x, y, z, w) => { return x + y + z + w; };
            var sum = func(1, 2, 3, 4);
            Console.WriteLine(sum);
            Console.Read();
 
            #endregion
原文地址:https://www.cnblogs.com/wuzehao/p/9962858.html