哪个更正确,为什么?
Control.BeginInvoke(new Action(DoSomething), null);
private void DoSomething()
{
MessageBox.Show("What a great post");
}
Run Code Online (Sandbox Code Playgroud)
要么
Control.BeginInvoke((MethodInvoker) delegate {
MessageBox.Show("What a great post");
});
Run Code Online (Sandbox Code Playgroud)
我觉得我在做同样的事情,所以什么时候适合使用MethodInvokervs Action,甚至写一个lambda表达式?
编辑:我知道写一个lambda vs之间并没有什么区别Action,但MethodInvoker似乎是出于特定目的.它有什么不同吗?