我正在使用 Visual Studio 2019 社区,并且有以下代码:
if(this != myOtherObject
&& anotherVariable != true)
{
//do something
}
这里的想法是我在 if 中有各种条件。所以我想知道是否有某种方法可以在调试中知道它是第一个条件是真的还是第二个等等。
如果没有,我认为可能的唯一方法是这样:
if(this != myOtherObject)
{
if(anotherVariable != true)
{
//do something
}
}
谢谢。
在您的条件中放置一个断点。
开始调试 (F5)
突出this != myOtherObject
您的状况
右键单击并选择 Add Watch
现在您在 Watch 窗口中有了它的计算值。(通常在底部弹出)
Quick Watch
如果你想要它的值一次,你可以使用(Shift+F9)。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句