C#匿名方法

            Func<string, string> test = delegate(string s) { return s + "end"; };
            Console.WriteLine(test("llllll"));

            Func<string, string> test1 = param => { return "start" + param; };
            Console.WriteLine(test1("llllll"));


            Action<string> test2 = delegate(string s) { Console.WriteLine(s); };
            test2("test2");
            Action<string> test3 = s => { Console.WriteLine(s); };
            test2("test3");

  

posted @ 2017-11-15 13:20  Quintinz  阅读(162)  评论(0编辑  收藏  举报