当在调用方法时,如果第二个参数为引用类型,则必须在该参数前加上'ref'关键字,否则会报错。示例代码如下:
int oldValue = 1; void IncreaseValue(ref int value) { value++; } IncreaseValue(ref oldValue);
在上述示例中,'oldValue'是一个整型变量,需要在调用'IncreaseValue'方法时使用'ref'关键字,以便将其作为引用类型参数进行传递。
上一篇:Argument2:CannotconvertfrombooltoSystem.Func<DAL.Cash,bool>
下一篇:argumentafter**mustbeamapping,notCursor