编译器错误 CS0231
更新:2007 年 11 月
错误消息
params 参数必须是形参表中的最后一个参数。
params 参数支持可变的参数数目,并且必须位于所有其他参数之后。有关更多信息,请参见方法(C# 编程指南)。
下面的示例生成 CS0231:
// CS0231.cs
class Test
{
public void TestMethod(params int[] p, int i) {} // CS0231
// To resolve the error, use the following line instead:
// public void TestMethod(int i, params int[] p) {}
static void Main()
{
}
}