多句语句如何用lambda写

.Net技术 码拜 9年前 (2015-05-11) 1282次浏览 0个评论
 

如题
原先这样的 用匿名委托 写两句话用分号隔开的

this.Dispatcher.Invoke(delegate 
         { 
            MessageBox.Show("ok"); 
            this.pb1.Value = 0; 
         });

现在两句话如何隔离

 this.Dispatcher.Invoke(()=>
            MessageBox.Show("ok")
            this.pb1.Value = 0
         );
20分
this.Dispatcher.Invoke(()=>{
            MessageBox.Show("ok");
            this.pb1.Value = 0;}
         );

这是送分题么……

引用 1 楼 starfd 的回复:
this.Dispatcher.Invoke(()=>{
            MessageBox.Show("ok");
            this.pb1.Value = 0;}
         );

这是送分题么……

百度不到吗 也只能送分了。 我怎么就没想到用大括号呢 逗号 圆括号都试过了 。。。


CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明多句语句如何用lambda写
喜欢 (0)
[1034331897@qq.com]
分享 (0)

文章评论已关闭!