这是给我错误的代码:
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'
答案 0 :(得分:1)
您似乎正在尝试使用out variables,但编译器不支持。用老式的方式做吧
bool? isStable;
s.GetWeight(out weightInLb, out weightInG, out weightInOz, out isStable);