【发布时间】:2012-03-08 01:50:23
【问题描述】:
//ok
Action<int> CallbackWithParam1 = delegate { };
//error CS1593: Delegate 'System.Action<int>' does not take 0 arguments
Action<int> CallbackWithParam2 = () => { };
只是想知道为什么会出现这种差异。 :-/
【问题讨论】:
-
不幸的是,没有一个很好的理由,就像@JaredPar 下面说的那样。只是省略了一些东西(我不确定是否有意)。
-
这看起来像是给... Eric Lippert 人的工作!
-
@Tudor 在此处插入蝙蝠侠主题。
标签: c# delegates lambda arguments