错误 CS1525:意外符号“?”,应为“.”在 monodevelop
Error CS1525: Unexpected symbol `?', expecting `.' in monodevelop
这是给我错误的代码:
s.GetWeight(out weightInLb, out weightInG, out weightInOz, out bool? isStable);
Error CS1525: Unexpected symbol `?', expecting `.'
这段代码调用函数GetWeight,代码如下:
public void GetWeight(out decimal? weightInLb, out decimal? weightInG, out decimal? weightInOz, out bool? isStable)
我做错了什么?请帮忙!
编辑
如果我更换 ?与一个。我收到错误:
Error CS0117: `bool' does not contain a definition for `isStable'
您似乎在尝试使用 out variables,但您的编译器不支持它。所以用老式的方式来做
bool? isStable;
s.GetWeight(out weightInLb, out weightInG, out weightInOz, out isStable);
这是给我错误的代码:
s.GetWeight(out weightInLb, out weightInG, out weightInOz, out bool? isStable);
Error CS1525: Unexpected symbol `?', expecting `.'
这段代码调用函数GetWeight,代码如下:
public void GetWeight(out decimal? weightInLb, out decimal? weightInG, out decimal? weightInOz, out bool? isStable)
我做错了什么?请帮忙!
编辑
如果我更换 ?与一个。我收到错误:
Error CS0117: `bool' does not contain a definition for `isStable'
您似乎在尝试使用 out variables,但您的编译器不支持它。所以用老式的方式来做
bool? isStable;
s.GetWeight(out weightInLb, out weightInG, out weightInOz, out isStable);