微软行动& Func 8结构?

时间:2012-05-10 11:33:10

标签: c# .net clr

我一直注意到ActionFunc代表,具有特定结构,从2到8 参数:

enter image description here enter image description here

为什么他们打开 - 显式计数 - 参数类型? (如果是这样,为什么8?)

如果我有10个参数呢?

修改

不再继续传统, 元组有7 ... ??

enter image description here

EDIT2

SystemCore.Dll中的

- 有1..16 params ver。

1 个答案:

答案 0 :(得分:3)

  

>为什么他们打开 - 显式计数 - 参数类型?

因为该语言不支持可变数量的Type参数。

  

> (如果是这样,为什么8?)

因为4通常应该足够了。

  

>如果我有10个参数呢?

然后您必须将以下内容添加到您自己的代码中:

 delegate void Action<T1, T2, ... , T10> (T1 arg1, T2 arg2, ..., T10 arg10);