有没有一种方法可以命名泛型 Func<...> 的参数以支持智能感知?
例子:
Func<int, int, int> f1 = new Func<int, int, int>(
(a, b) => { return a + b }
);
f1(2, 3);
最佳答案
没有。不过,您可以定义自己的委托(delegate)/接口(interface)。
public delegate int DoTheThing(int a, int b);
或
public interface IThingDoer {
int DoTheThing(int a, int b);
}
关于c# - Func<...> args 有 "unnamed"个参数。有没有办法给它们命名?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71203523/