更新:2007 年 11 月
错误消息
参数“number”必须与关键字“keyword”一起传递
如果您要将参数传递给带有 ref 或 out 参数的函数,但您在调用时没有包括 ref 或 out 关键字,或者包括了错误的关键字,就会发生此错误。错误文本中指出了应使用的正确关键字以及导致失败的参数。
下面的示例生成 CS1620:
// CS1620.cs
class C
{
void f(ref int i) {}
public static void Main()
{
int x = 1;
f(out x); // CS1620 – f takes a ref parameter, not an out parameter
// Try this line instead:
// f(ref x);
}
}