【发布时间】:2012-02-13 12:28:46
【问题描述】:
我有一些线程检查,我可以通过调用 BeginInvoke(new Action<string,string>........ 来完成以下工作,但我想知道您是否可以以某种方式使用预定义的操作?
private Action<string, string> DoSomething();
private void MakeItHappen(string InputA, string InputB)
{
if (this.InvokeRequired)
{
this.BeginInvoke(DoSomething(InputA, InputB));
}
else
{
Label.Text = "Done";
MyOtherGUIItem.Visible = false;
}
}
【问题讨论】:
-
“预定义操作”是什么意思?
-
它预定义为私有字段而不是执行 new Action
标签: c# .net multithreading .net-4.0 delegates