这是给我错误的代码:
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'
看起来您正在尝试使用变量,而您的编译器不支持它。所以用老式的方式做
bool? isStable;
s.GetWeight(out weightInLb, out weightInG, out weightInOz, out isStable);
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句