【发布时间】:2013-07-18 04:03:11
【问题描述】:
我想像这样动态地传入一个 void 或一个 int/string/bool(它返回一个值)。
Delay(MyVoid);//I wont to execute a delay here, after the delay it will execute the the param/void like so...
public static void MyVoid()
{
MessageBox.Show("The void has started!");
}
public async Task MyAsyncMethod(void V)
{
await Task.Delay(2000);
V()
}
ps,我尝试过使用 Delegates,但它不允许将其用作参数。
【问题讨论】:
-
以后不要重新提出问题,请编辑您的原始问题。如果我在发布答案之前看到了这个问题,我会简单地投票关闭这个问题。就目前而言,我建议您删除您的其他问题。
标签: c# parameters delegates void