Design Time Expression Evaluation - Immediate Window

Immediate Window is a build in Visual Studio tool that people often forget about. Mostly because it shows only at debug time and usage is not obvious as 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. Lets 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.


Thursday, August 14, 2008 | Comments (2) | Add Comment

Comments

Gravatar

Re:Design Time Expression Evaluation - Immediate Window

try as i might, i cannot get vs2008 c# immediate window to do your example at design time...what am i doing wrong?

9/29/2009 1:52:17 PM | by Kevon Ward
Gravatar

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.

Gravatar

Re:Design Time Expression Evaluation - Immediate Window

how i can see the C#.net output in immediate windows ,what is code for that in c#.net

4/16/2010 1:38:57 AM | by vishal
Gravatar

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.

New Comment

Your Name:
Email (for internal use only):
Subject:
Comment:
 
Code above:

Categories

Recent Tweets

Valid XHTML 1.0 Transitional