KARPACH

WEB DEVELOPER BLOG

Design Time Expression Evaluation - Immediate Window

Immediate Window is a built-in Visual Studio tool that people often forget about. Mostly because it shows only at debug time and usage is not obvious as a watch window. The Immediate window is used at debug and design time to debug and evaluate¬†expressions, execute statements, print variable values, and so forth. Yes, you can use Immediate window at design time. Let’s say you write a method:

private static int Sum(int a, int b)
{
    return a + b;
}

Then you can type in Immediate window:

?Sum(10,12)

and below would be result:

22

You can even debug, while you are in design mode. More information about debugging at design time in MSDN.

Posted on August 14, 2008 by

Comments

Posted on 9/29/2009 01:52:17 PM by Kevon Ward

try as i might, i cannot get vs2008 c# immediate window to do your example at design time…what am i doing wrong?
Create new console application. Copy paste my piece of code. Press Ctrl - D,I to show Immediate window. Type ?Sum(10,12) in it and hit enter. You should see result then.

Posted on 4/16/2010 01:38:57 AM by vishal

how i can see the C#.net output in immediate windows ,what is code for that in c#.net
You can’t see C# output in immediate window. You can call method from immediate window and then see what this method returns. You can use Debug.Write method to write to output window, but not to immediate window.

Posted on 8/23/2010 11:53:42 AM by Eddie Torin

But you can redirect all output to immediate window by choosing this option in VS config.