C#4.0 新特性 - 匿名方法,lambds

 匿名方法:

Action<string> action = new Action<string>(delegate(string name)
        {
            MessageBox.Show("Hello" + name);
        });

action(“aaa”);

lambds:

Action<string> action = aa => { MessageBox.Show(aa); };

action(“aaa”);

posted on 2012-04-02 23:16  项目管理之家  阅读(200)  评论(0编辑  收藏  举报

导航