JimDel
JimDel

Reputation: 4359

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.

Upvotes: 8

Views: 766

Answers (4)

Dmytro
Dmytro

Reputation: 17186

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.

Upvotes: 1

Malgaur
Malgaur

Reputation: 1850

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.

Upvotes: 7

Steven Doggart
Steven Doggart

Reputation: 43743

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

Upvotes: 1

Chris Shain
Chris Shain

Reputation: 51339

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

Upvotes: 1

Related Questions