Suggested Videos
Part 2 - How to find the containing namespace of a class
Part 3 - Visual Studio Keyboard Shortcuts
Part 4 - Command window in visual studio
In this video, we will discuss what is Immediate window and it's purpose. In Part 4 we discussed Command window.
Immediate window is very helpful during debugging to evaluate expressions, execute statements, and print variable values.
There are several ways to get to Immediate window in visual studio
1. Type immed in command window and press enter. To get to command window from Immediate window, type >cmd and then press enter.
2. Thru visual studio menu: Debug - Windows - Immediate
3. Keyboard shortcut: Ctrl + D + I
The visual studio commands that we can execute in command window are also supported in Immediate window, but you should use angular bracket (>). For example to get to Open File dialog,
Type >OF and then press ENTER key
Immediate window supports execution of a function at design time. Let's understand this with an example. Consider the following program
If you want to execute PrintSum() function at design time, in the Immediate window, type the following and press ENTER.
?PrintSum(1,2,3)
Most of the time we use immediate window at runtime during debugging to inspect, change and print variable values. Let's understand this with an example. Insert a breakpoint on PrintSum() and execute the following
?n1 prints 1
?n1==1 prints true
?n1==n2 prints false
?n1=10 changes the value of n1 to 10
Please Note: IntelliSense is also available in Immediate window.
Part 2 - How to find the containing namespace of a class
Part 3 - Visual Studio Keyboard Shortcuts
Part 4 - Command window in visual studio
In this video, we will discuss what is Immediate window and it's purpose. In Part 4 we discussed Command window.
Immediate window is very helpful during debugging to evaluate expressions, execute statements, and print variable values.
There are several ways to get to Immediate window in visual studio
1. Type immed in command window and press enter. To get to command window from Immediate window, type >cmd and then press enter.
2. Thru visual studio menu: Debug - Windows - Immediate
3. Keyboard shortcut: Ctrl + D + I
The visual studio commands that we can execute in command window are also supported in Immediate window, but you should use angular bracket (>). For example to get to Open File dialog,
Type >OF and then press ENTER key
Immediate window supports execution of a function at design time. Let's understand this with an example. Consider the following program
using System;
namespace ConsoleApplication1
{
class Program
{
static void Main()
{
int Sum = PrintSum(1, 2, 3);
Console.WriteLine(Sum);
}
public static int PrintSum(int n1, int
n2, int n3)
{
int sum = n1 + n2 + n3;
return sum;
}
}
}
If you want to execute PrintSum() function at design time, in the Immediate window, type the following and press ENTER.
?PrintSum(1,2,3)
Most of the time we use immediate window at runtime during debugging to inspect, change and print variable values. Let's understand this with an example. Insert a breakpoint on PrintSum() and execute the following
?n1 prints 1
?n1==1 prints true
?n1==n2 prints false
?n1=10 changes the value of n1 to 10
Please Note: IntelliSense is also available in Immediate window.
No comments:
Post a Comment
It would be great if you can help share these free resources