【发布时间】:2011-04-24 13:09:10
【问题描述】:
我正在使用它来更改其他线程上的某些内容:
MethodInvoker m = () => { login_submit.Text = "Login"; };
if (InvokeRequired)
{
BeginInvoke(m);
}
else
{
Invoke(m);
}
这工作正常。
如何将参数传递给该 Lamba 表达式?
我想那样做:
MethodInvoker m = (string txt) => { login_submit.Text = txt; };
if (InvokeRequired)
{
BeginInvoke(m); // I need to pass txt string in some way here.
}
else
{
Invoke(m); // I need to pass txt string in some way here.
}
【问题讨论】:
-
@Cody,我认为它是“某物”的缩写。
标签: c# .net multithreading invoke