Func

摘要:Func

還是做記錄一下
不過比較好奇的是
c 的"dyco你好" 並沒有顯示出來 @@;

 Func<string, string> c = new Func<string, string>(p => p + "你好<br>");

        Func<string, string> c1 = new Func<string, string>(
            delegate(string s)
            {
                Response.Write(s + "真帥<br>");
                return "";
            }

            );
        
        Func<string, string> c2 = new Func<string, string>(
             delegate(string s)
             {
                 Response.Write(s + "真酷<br>");
                 return "";
             }
            
            );

        //無傳回
        Action c3 = new Action(delegate()
        {
            Response.Write("test");
        });

        //連結多個委派方法
        c = c + c1 + c2;
       
        //結果為
        
        Response.Write(c("dyco"));
        c3();


        //==輸出結果==
        //dyco真帥
        //dyco真酷
        //test