相关疑难解决方法(0)

为什么必须在作为普通的Delegate参数提供时转换lambda表达式

采取方法System.Windows.Forms.Control.Invoke(Delegate方法)

为什么会出现编译时错误:

string str = "woop";
Invoke(() => this.Text = str);
// Error: Cannot convert lambda expression to type 'System.Delegate'
// because it is not a delegate type
Run Code Online (Sandbox Code Playgroud)

但这很好用:

string str = "woop";
Invoke((Action)(() => this.Text = str));
Run Code Online (Sandbox Code Playgroud)

当方法需要普通代表时?

c# lambda delegates c#-3.0

120
推荐指数
3
解决办法
6万
查看次数

标签 统计

c# ×1

c#-3.0 ×1

delegates ×1

lambda ×1