Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我一直注意到两者Action和Func代表,具有从 2 到 8参数的特定结构:
Action
Func
他们为什么要开放显式计数参数类型?(如果是这样,为什么是 8 个?)
如果我有 10 个参数呢?
停止 8 传统,元组有 7 ... ??
在 SystemCore.Dll - 有 1..16 参数版本。
> 为什么他们打开显式计数参数类型?
因为该语言不支持可变数量的 Type 参数。
> (如果是,为什么是 8 个?)
因为通常 4 应该就足够了。
> 如果我有 10 个参数呢?
然后,您必须将以下内容添加到您自己的代码中:
delegate void Action<T1, T2, ... , T10> (T1 arg1, T2 arg2, ..., T10 arg10);