码迷,mamicode.com
首页 > 其他好文 > 详细

匿名函数 invoke

时间:2015-01-19 12:14:14      阅读:146      评论:0      收藏:0      [点我收藏+]

标签:

        delegate string MyDele(string str);
        string MyFun(string str)
        {
            return str;
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            MyDele m = new MyDele(MyFun);
            this.Text = m("实名");
            //匿名函数
            //1、
            this.Text = new MyDele(delegate(string str)
                        {
                            return str;
                        })("匿名");

            //2、用于Invoke方法中
            this.Invoke(new EventHandler(delegate(object o, EventArgs e1)
                {

                }));
            //3、用于Invoke方法中
            this.Invoke(new MethodInvoker( delegate()
                {

                }));
            //4、用于定义线程
            System.Threading.Thread th=new System.Threading.Thread(new System.Threading.ThreadStart(delegate()
                {
                
                }));

        }

  

匿名函数 invoke

标签:

原文地址:http://www.cnblogs.com/xiaochun126/p/4233198.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!