41.4. Immediate Window
Quite often when you are writing code or debugging your application, you will want to evaluate a simple expression either to test a bit of functionality or to remind yourself of how something works. This is where the Immediate window comes in handy. This window enables you to run expressions as you type them. Figure 41-4 shows a number of statements — from basic assignment and print operations through to more advanced object creation and manipulation.
Figure 41.4. Figure 41-4
Figure 41-4 shows a new Customer object being created in a C# project within the Immediate window. Within a Visual Basic project you can't do explicit variable declaration (for example, Dim x as Integer). Instead it is done implicitly using the assignment operator.
One of the more useful features of the Immediate window is that it can be used while you are writing code. When you create new objects in the Immediate window at design time, it will create an instance of that object using the Object Test Bench. If you invoke a method or property that contains an active breakpoint, Visual Studio will change to debug mode and break at the breakpoint. This is particularly useful if you are working on a particular method that you want to test without running the entire application.
The Immediate window supports a limited form of IntelliSense, and you can use the arrow keys to track back through ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access