Lambda应用


//MethodInvoker的使用

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ConPra
{
    class Program
    {
         delegate int Show(int y);
         delegate void OK();
        static void Main(string[] args)
        {
            int num=10;
           // Action myAction = new Action();
            Show myShow = new Show(x=>x);
            if (myShow(1)==1)
            {
                Console.Write("OK");//输出ok
            }
            MethodInvoker myOK = new MethodInvoker(delegate
            {
                Console.Write("OKKKKK");
                Console.Write("OKKKKK");
            });


            myOK();
            Console.Read();
        }
    }
}

posted @ 2013-04-24 18:26  Predator  阅读(110)  评论(0编辑  收藏  举报