以下代码编译并运行正常。MethodInvoker的这种用法的正确语法是什么?
void myInvokedMethod(string s)
{
Console.WriteLine(s);
}
void myInvoker()
{
Invoke(new MethodInvoker(delegate() { myInvokedMethod("one"); }));
Invoke(new MethodInvoker(delegate { myInvokedMethod("two"); }));
}
当我打电话myInvoker,以两个呼叫myInvokedMethod打通。 代表之后的括号是什么意思,为什么它们看起来是可选的?