首页 > 其他 > 详细

匿名函数 invoke

时间:2015-01-19 12:13:54      阅读:266      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!