且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

C#泛型 - 可以创建具有n个泛型类型的方法..?

更新时间:2021-11-09 23:42:41

没有 - 泛型类型和方法的元数固定在每个类型/方法的基础

No - the arity of generic types and methods is fixed on a per-type/method basis.

这就是为什么有各种不同的动作< ...> Func键< ...> 元组LT; ...> 的框架类型

That's why there are all the different Action<...>, Func<...> and Tuple<...> types in the framework.

有时候这是一个耻辱,但它得到的方式的相对的很少,我怀疑各种各样的事情会多出很多复杂的可变参数数量。

Occasionally that's a shame, but it gets in the way relatively rarely, and I suspect all kinds of things would be a lot more complicated with variable arity.