× Please, log in to give us a feedback. Click here to login

You must be logged to download. Click here to login


MrBool is totally free and you can help us to help the Developers Community around the world

Yes, I'd like to help the MrBool and the Developers Community before download

No, I'd like to download without make the donation


MrBool is totally free and you can help us to help the Developers Community around the world

Yes, I'd like to help the MrBool and the Developers Community before download

No, I'd like to download without make the donation

Innovations of the IDE to increase productivity

In this article Innovations of the IDE to increase productivity

Visual Studio 2005

Innovations of the IDE to increase productivity

Andrey Sanches e Alexandre Tarifa

This article discusses:

This article uses the following technologies:

·        New Visual Studio 2005 IDE resources;

·        Refactoring;

·        Code Snippets, Auto Correct, improvements in Debugger and IntelliSense.

·        Visual Studio 2005.


In November 2005, Microsoft officially announced the release of the new software development tool based on .NET technology, the Visual Studio 2005. With plenty of new resources, the tool intends to increase, even more, applications development productivity, including improvements in the IDE, Debugger, Refactoring, IntelliSense, Code Snippets, Auto Correct and a lot more!

Edit and Continue

Who has worked with Visual Basic 6.0 ought top remember the “Edit and Continue”, resource that allowed code edition in runtime without needing to restart the compilation process, especially when the application was interrupted by an error in debugging mode. In Visual Studio 2003, this resource had that to be modified by .NET Framework 1.1 characteristics, exactly for the model of compilation.

In Visual Studio 2005 this restriction does not exist and now it is already possible to use this resource to edit codes during execution time, without affecting the execution of the system in debug mode. To test this resource, place a breakpoint in its code and run the program. When Visual Studio .NET 2005 interrupts and stops in the place indicated by the breakpoint, modify something in its code, modify the name of a variable or even develop something. Continue debugging and see that the compiler will understand the new modifications and will execute as codified!


Since the Visual Studio .NET 2003 developers have been waiting for code refactoring tools. At that time, it was still possible to use some third party tools that could be connected (in the form of add-ins) to the Visual Studio to benefit from these resources. Basically, a tool for refactoring has the function to adjust the code, presenting quality improvements without affecting its main functioning. This means to say that, from time to time, it is advisable to perform the refactoring in the code in order to find small improvements to be made and always take care that the codes are not extensive, repetitive or even incoherent for the initial purpose.

In Visual Studio 2005, the refactoring tool for C# is already built-in, while for Visual Basic .NET it is necessary to download it. It is important to remember that both have basically the same features, although the VB.NET version has a little more improved visual effects. In this article, we will demonstrate, in action, the refactoring tool for Visual Basic .NET, which can be downloaded for free at msdn.microsoft.com/vbasic/downloads/tools/refactor.

Extract Method – It allows dividing a method with many code lines into small blocks, moving regions of the code to new methods and including a call to that same code in the original place. This procedure makes the code more organized and sheltered, without modifying the behavior of the method or its original calls. See in Figure 1 how simple it is to use this resource.


Figure 1.
Selecting the text and applying “Extract Method”

After selecting the code to be extracted to the new method, right-click over the selection, point to “Refactor” and choose Extract Method. The tool will question in which position you wish to place the new method that will be created, in agreement to that shown in Figure 2.




Figure 2. The red arrow indicates where the new method will be created


Tip: The Targeting window offers shortcuts to execute the refactoring operations.


Selecting with the up/down arrow it is possible to determine the position of the new method in your code, with the Enter key the tool creates the new method. The refactoring tool will suggest the method name; in case you are not in agreement you can modify the method name yourself in the green area of the code, as shows Figure 3.



Figure 3.
Informing the name of the new method

Encapsulate Field – Allows to expose the classes attributes as properties so that its manipulation is possible externally. With this feature we no longer need to create properties (with get/set) for all attributes manually, the tool does the “heavy” work. See in Figure 4 how to apply this method.

Figure 4.
Encapsulating the attribute of a class in a property

To apply this refactoring, right-click over the attribute that you wish to encapsulate, point to “Refactor!” and select Encapsulate Field. The tool will ask the position of the Property that will be created; after selecting the position confirm with Enter, the property will be created as shown in Figure 4. It is also possible to choose the name of new property. Productive and simple, right?

Reorder Parameters – Once we have created a method and distributed calls in various points of the software, you must agree with me that it would be difficult to change the order of the parameters. With refactoring, this problem ends completely - see its execution in Figure 5.

Figure 5.
Reorganizing the parameters of a method

Right-clicking over a method’s parameters’ area, point to “Refactor!” and select Reorder Parameters. The refactoring tool will show a selection in the first parameter and a section just below, informing about the actions that can be carried through. Notice, also, that there is an arrow from left to right; clicking over it, it is possible to make the exchange of the parameters, without having to type or modify anything manually (notice the effect of the animation). After changing the parameters in the desired manner, press Enter and the tool will indicate the places of the code that will be affected by the change.

Besides immediately showing what the call will be like after the exchange and already with the correct order of the parameters (Figure 6), a window is also shown containing the execution options that can be activated by the keyboard, but nothing restrains from clicking directly in the alternatives of the window beside containing the suggestions of modifications of the method.

Figure 6. Modifying automatically the calls’ references


To finish, press Enter in each call or Alt+Enter to modify all the calls at once, the modifications are made and the new order of the parameters for all the references will be modified.

Create overload – Overloading a method means creating methods with similar logics however with same names, varying the parameters in their signature. Now we can easily create overloaded methods using refactoring. Right-click over the desired method, point to “Refactor!”, Create Overload. The tool will request the position of the new method as shown before, select with up/down arrows and press Enter to confirm. At this moment the last parameter is displayed with a highlight so that it is excluded and the new overload generated. Press spacebar to remove/maintain the parameter as shown in Figure 7.


Figure 7.
Creating new overload of the method


Notice that Visual Studio 2005 already sets the code automatically and makes the call to the new method. As a parameter was withdrawn, the tool placed a blank parameter and sent it to the main method.


As we know, the IntelliSense features are used to make code typing and .NET Framework functionalities location easier. In Visual Studio 2005, the feature was quite improved: at any need, the IntelliSense takes action, even in setup files, as show Figures 8 and 9.


Figure 8.
  IntelliSense helping in the creation of connection strings key


Figure 9.
IntelliSense being used in setup files also


As demonstrated, the interaction of the developer with the setup is complete, through the IntelliSense the attributes of all the tags that are part of the App.config or Web.Config are exhibited as they are being needed. In Figure 9, the tag of the node shows the attributes that haven’t yet been included in the code. After typing, see that the attributes providerName and connectionStrings are no longer displayed in the listing, since they had already been included previously.

The same happens in the codification area of any method, the IntelliSense operates making codification easier for the developer. See in Figure 10 an example of the action of the IntelliSense where, after typing “as”, the listing of valid options for insertion in the code is displayed.


Figure 10.
 In the declaration of the variable, the relation of objects is already shown even before typing begins and follows it along the process

Debugger DataTips

In Visual Studio 2003 already it was possible to inspect an object by selecting it and using the shortcut Shift + F9 (Quick Watch) to see its contents, such as the values of attributes and properties contained and instanced in it. Visual Studio 2005 makes the same resource available, but now without the need to open windows and windows until you reach the desired objects, it is enough to move the mouse over what you wish to visualize and the tool brings all the available information, as shows Figure 11.



Figure 11.  With the mouse over the desired code it is possible to inspect the whole structure of any object

Code Snippets

The Snippets are code templates stored in XML files that bring as main advantages the increase in productivity for the developer and the easiness to store code patterns defined by the developing team. The Visual Studio 2005 has many already added codes, and it is possible to create new files and add them to the code library. The library is organized by categories as shown in Table 1.





Compilation, resources ands setups

Collection and Arrays

Creation of arrays, ordered lists, etc.

Common Code Patterns

Treatment of exceptions, loops, conditionals, properties, events, etc.

Connectivity and Networking

Sending of email, ping, net setups, net status, etc.


Execution of commands, DataReader, DataSet and several possibilities of database manipulation

Data Types

Conversion and declaration of variables

File System

Manipulation of files


Mathematical calculus in general

Office Development

Manipulation of Office, Word, Excel and Outlook controls


Hash Code, Cryptography

Windows Forms

Manipulation of controls, drawing, sounds etc.


Manipulation of XML documents

Table 1. Code Snippets Categories

Visual Studio 2005 does not initially bring any Code Snippets editor, only the already existing XML files (Figure 12). However, it is possible to download some editors. The Visual Basic development team made the first one available at msdn.microsoft.com/vbasic/downloads/2005/tools/snippeteditor. In time, several internet sites should share Code Snippets, increasing even more the possibility for us to find pre-programmed codes for all needs.

A very common environment for the use of Code Snippets would be in a development team, where a standard library could be created, with all the practices that the team judged to be important. With this, the standardization of the development team would be huge and the software quality tends to increase and by much.


Figure 12. Code Snippets Manager, accessible through the menu Tools

To add a code to the project, just right-click over the code editor and select the Code Snippet option (Figure 13).


Figure 13.
 Code Snippet selection

In the code editor itself, the categories are already displayed (Figure 14). As an example, select Processing Drives, Folders, and Files.



Figure 14.  Code Snippet selection by category


With the category selected, (Figure 15), the codes contained in the category are displayed. Select Read Text from a File.


Figure 15
.  Code selection


The code is added (Figure 16) already highlighting the regions that will probably be modified, especially names of variables and parameters.


Figure 16.  Added code

Auto Correct

The automatic correction is an evolution of the traditional resource in the editors where, when adding any non existing keyword, non existing variable or any other code that can bring an error, the auto correct besides identifying these errors, suggests the developer a correction with many possibilities.

Figure 17. Incorrect code

In this example, (Figure 17), the type “sting’ does not exist. The editor, besides informing us that there is something wrong with this word, brings us correction possibilities (Figure 18). Just select the best option from the corrections presented.


Figure 18. 
Correction suggestions

Apart from the treatment of common errors, many suggestions can be displayed (Figure 19), an example is the creation of a read-only property that is passing values. The code editor displays two suggestions, remove the Set or the ReadOnly. This because a read-only property can’t have attributed value, of course.


Figure 19. 
Suggestions of corrections for more complete treatments

Exception assistant

During code compilation in debug mode, at the moment an exception occurs, the code editor shows where an error occurred. So far, it works in the same way as in the previous versions, however, in this new version, solutions are displayed for the problem shown.

Figure 20
. Besides stopping the breakpoint at the incorrect code, the solution is presented to the developer

In the example presented (Figure 20), the error is caused by the lack of an instance of the ds object (of the DataSet type), the treatment window brings the suggestion to create this instance.


In Visual Studio 2003, there is a problem related to the positioning of the internal windows, making it common to “drag” a window for various moments until it adjusted in the desired position. In Visual Studio 2005, when we drag a window (Figure 21), positioning guides are shown, making this simple task a lot easier. Just drag the window over the guide and positioning is accomplished.



Figure 21
. It is a lot easier to organize windows in the Visual Studio 2005


It is easy to notice the investment that Microsoft had with the Visual Studio 2005. We showed in few topics some of the great new features of this powerful tool, that supports.NET Framework 2.0. It is important that you, developer, make contact as soon as possible with this new version so that you can have a greater productivity in the day to day work and discover even more all of the available resources.


Andrey Sanches (andrey.sanches@gmail.com) is .NET consultant of the ITGROUP and works with systems development in .NET technology since its beta version. MCP (Microsoft Certified Professional), Leader of the codificando.net - SP community (www.codificando.net), Microsoft lecturer in several events of his area, coaches .NET trainings and mini-courses in various companies and writes articles for sites such as DevMedia Portal, and magazines such as MSDN Magazine and Web Mobile. He has spent a reasonable amount of his time discovering and studying the wonders of Visual Studio.NET 2005 and admiring all the available resources of this excellent tool. More new features can be found in his blog: HTTP://weblogs.pontonetpt.com/andreysanches



Alexandre Tarifa (alexandret@itgroup.com.br) is ITGROUP consultant, MVP (Most Valuable Professional – Visual Developer Visual Basic), MCAD (Microsoft Certified Application Developer) and MCT (Microsoft Certified Trainer). UMESP graduate and Universidade Federal de São Carlos Computer Science post graduate; Leader of the users’s group, Codificando.net São Paulo (sp.codificando.net); he writes articles for the MSDN Magazine and for Web Mobile and for the sites MSDN Brasil and Enterpriseguys. Author of the Express series books (www.projetoexpress.net). Visit the author’s blog: http://weblogs.pontonetpt.com/alexandretarifa

Columnist not avaible

What did you think of this post?
To have full access to this post (or download the associated files) you must have MrBool Credits.

  See the prices for this post in Mr.Bool Credits System below:

Individually – in this case the price for this post is US$ 0,00 (Buy it now)
in this case you will buy only this video by paying the full price with no discount.

Package of 10 credits - in this case the price for this post is US$ 0,00
This subscription is ideal if you want to download few videos. In this plan you will receive a discount of 50% in each video. Subscribe for this package!

Package of 50 credits – in this case the price for this post is US$ 0,00
This subscription is ideal if you want to download several videos. In this plan you will receive a discount of 83% in each video. Subscribe for this package!

> More info about MrBool Credits
You must be logged to download.

Click here to login