我从这个方法中得到了奇怪的结果:
当我将null传入StartDepth时,由于“Depth-StartDepth”似乎首先将StartDepth转换为默认值0(降级?),而不是首先查看它是否为空并替换Globals.StartDepth,因此合并失败。
这是一个已知的问题吗?我通过添加括号使其工作,但我真的没有预料到会这样工作。
public static double YFromDepth(double Depth, double? StartDepth, double? PrintScale)
{
return (Depth - StartDepth ?? Globals.StartDepth) * PrintScale ?? Constants.YPixelsPerUnit ;
}
当我将null传入StartDepth时,由于“Depth-StartDepth”似乎首先将StartDepth转换为默认值0(降级?),而不是首先查看它是否为空并替换Globals.StartDepth,因此合并失败。
这是一个已知的问题吗?我通过添加括号使其工作,但我真的没有预料到会这样工作。