【发布时间】:2010-11-22 10:18:57
【问题描述】:
我在调用此示例函数的代码中使用匿名委托:
public static int TestFunction(int a, int b) {
return a + b;
}
委托看起来像这样:
var del = new Func<int, int, int>(TestFunction);
我的问题是:如何为TResult 指定void 返回类型?以下不起作用:
public static void OtherFunction(int a, string b) { ... }
var del = new Func<int, string, void>(OtherFunction);
【问题讨论】: