这是给我错误的代码:
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);