错误CS1525:意外的符号“?”,期待“。”在monodevelop

问题描述 投票:0回答:1

这是给我错误的代码:

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'
c# monodevelop
1个回答
1
投票

看起来你正在尝试使用out variables,它只是你的编译器不支持。所以用老式的方式做

bool? isStable;
s.GetWeight(out weightInLb, out weightInG, out weightInOz, out isStable);
© www.soinside.com 2019 - 2024. All rights reserved.