Evaluating an Expression
See Also
When you are in a debugging session, you can evaluate any expression to
view the values of local variables for the current method, class
variables, and method calls.
You can view the values returned by each method call in the expression
by stepping through an expression.
To evaluate an expression:
- Start a debugging session.
- Choose Debug > Evaluate Expression (Ctrl-F9) from the main menu.
- Type the expression in the Evaluate Expression dialog box and click Evaluate. The result is
shown in the Results pane of the dialog box.
You can set a watch for the expression by clicking the Watch button.
The watch is added to the Watches window.
Notes:
- If you evaluate a method that changes a global variable, the global variable's
value is changed in the debugging session as well.
- If you try to evaluate a variable that is outside the scope of the current
method, the IDE says "variable" is not a known variable in current context.
You can use the Call Stack window to change the current method context.
- If you try to access a global variable before the file that contains the variable is
instantiated, the IDE says Cannot access instance variable "variable" from static context.
- See Also
- Stepping Through an Expression
- Creating a Watch
- Creating a Fixed Watch
- Using the Call Stack
- About Debugging Applications
Legal Notices