While debugging, isn't there a way to "mouse over" a condition in an "if" statement to see if it evaluates to true or false in VS2010? I could have sworn there was, but I can't seem to get it to work.
Yes. Mouse-over the operator. For if(a || b)
, simply mouse-over the ||
.
You can even break down complex expressions. For if(a || !(b is string))
you can mouse-over the !(
portion to see what the result of the negation is.
Be sure you know your order of operations, though. For if(a || b && c)
, the ||
will give you the final result, where the &&
will give you the result of only the b && c
portion.
Highlight the condition and type Ctrl-Alt-Q (quick watch).
Yes, if you select/highlight the expression, then hover over the selected text, it will show you the evaluation of whatever is selected.
As an option you can set your condition value to a bool variable and during debugging you can see it's value... Fore example:
bool condition = a > b;
if (condition)
{
// Do some stuff
}
And while debugging "mouse over" condition
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With