我在C#中遇到匿名委托lambda时遇到问题.我刚刚将应用程序转换为C#5,代表们对我一切都失控了.任何帮助都会很棒.具体错误是:
无法将lambda表达式转换为"委托"类型,因为它不是委托类型
public void UpdateUserList()
{
if (!Monitor.TryEnter((object)this.LvPerson, 150))
return;
if (this.InvokeRequired)
{
this.Invoke((Delegate) (() => this.UpdateUserList()));
}
else
{ ... }
}
Run Code Online (Sandbox Code Playgroud)
我也试过了
this.Invoke(() => {this.UpdateUserList();});
Run Code Online (Sandbox Code Playgroud)
在将项目从Visual Studio 2008移动到Visual Studio 2015之前,我不确定问题出在哪里.
再次感谢您的帮助!