Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Isn't there a way to "mouse over" a condition in an "if" statement to see true or false in VS2010?

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.

like image 813
JimDel Avatar asked Aug 21 '12 20:08

JimDel


4 Answers

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.

like image 160
Malgaur Avatar answered Nov 15 '22 22:11

Malgaur


Highlight the condition and type Ctrl-Alt-Q (quick watch).

like image 41
Chris Shain Avatar answered Nov 15 '22 21:11

Chris Shain


Yes, if you select/highlight the expression, then hover over the selected text, it will show you the evaluation of whatever is selected.

like image 1
Steven Doggart Avatar answered Nov 15 '22 22:11

Steven Doggart


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.

like image 1
Dmytro Avatar answered Nov 15 '22 23:11

Dmytro