Welcome Login

Immediate window

Visual Studio

Debug > Windows > Immediate

The Immediate window is used at design time to debug and evaluate expressions, execute statements, print variable values, etc. It allows you to enter expressions to be evaluated or executed by the development language during debugging.

You can use this window to issue individual Visual Studio commands. The available commands include EvaluateStatement, which can be used to assign values to variables. The Immediate window also supports IntelliSense.

To view variable values:


1. Run in debug mode

2. Type variable name into immediate window, and press enter

or >Debug.Print msg
or ? msg

Note: ? is an alias for Debug.Print

To access properties of a variable, use the member access operator (.).



You can perform calculations by entering expressions.

msg.Length * 2

You can also execute methods, both against objects and static versions.

msg.Replace("morning", "evening")
"Good evening world"


To clear immediate window:

Right-click within the white area > choose "Clear All"


Entering commands:

You must enter '>' when issuing Visual Studio commands in the Immediate window.

Task                             Solution                                              Example

Evaluate an expression. Preface the expression with a question mark '?'. ? a+b

Temporarily enter Command mode Enter the command, prefacing it with '>' >alias

Switch to the Command window. Enter cmd into the window, >cmd
prefacing it with '>'

Switch back to the Enter immed into the window without '>' immed
immediate window



Note: keyboard shortcut: (Ctrl-Alt-I)

See: command window

Created on: Monday, November 7, 2011 by Andrew Sin