Understanding Visual Studio 2005

Microsoft has finally released Visual Studio 2005. In fact, developers were eagerly waiting for the same. Prior to this release, Microsoft had released several preview editions and developers (including beta testers) had got a chance to explore the product and provide feedback to Microsoft.

Visual Studio 2005 can be freely downloaded by clicking here. The product is also available in the form of CD’s for those enrolled in Microsoft’s Beta Testing Program.

You can submit bug reports and other issues associated with the product through MSDN Product Feedback Center. You can also view submissions posted by other developers.

In this article, I will examine three of the interesting features included with Visual Studio 2005 such as:

  • (1) Surround With

  • (2) Refactoring

  • (3) Insert Snippet

Now let us examine each of the above features in detail

Surround With

Applicability – Visual C#

The Surround With feature enables you to automatically add a portion of the respective code syntax very easily. The main benefit of this feature is that the relevant code will be added instantly with the help of Visual Studio .NET and hence errors can be avoided. Your job is to dress up the blank spaces with the work to be done.

For instance, if you would like to add a do-while loop, it can be done by following certain simple steps

Double click the form to open the code window. Right click and select the option Surround With from the IntelliSense option of the popup menu (See Figure 1)

 

microsoft, visual studio, msdn, visual c#, asp.net 

You will view a list box with lot of options as shown in Figure 2

READ  ASP.NET 4 and Visual Studio 2010 Released

microsoft, visual studio, msdn, visual c#, asp.net

For the purpose of this article, I’ve selected the do statement option. Double click on it and your code window will look like as shown below

microsoft, visual studio, msdn, visual c#, asp.net

You can add code snippets similar to the one shown above for almost every important task using this feature.

Refactoring

Applicability: Visual C#

Refactoring is one of the interesting features included with Visual Studio 2005. It enables you to automatically extract a certain portion of code snippet to a method. For instance, this feature will be useful if you have a source code with 2000 lines and you need to extract 550 lines of code from it.
The original code will be replaced with the created method call. Have a look at the walkthrough given below and you will understand the scene behind this cool feature
In order to work with this feature, you need to first add some code and select the same. Otherwise, IDE will show a message box as shown below.

microsoft, visual studio, msdn, visual c#, asp.net

Code Window before Refactoring

microsoft, visual studio, msdn, visual c#, asp.net

Right click the selected code and choose the Refractor -> Extract Method option. You will be presented with a dialog box as shown below

microsoft, visual studio, msdn, visual c#, asp.net

Enter a new method name. The method is a static method and is having private scope. Upon clicking OK, the selected code snippet will be enclosed inside the above method signature as shown in the figure given below

Code Window after Refactoring

microsoft, visual studio, msdn, visual c#, asp.net

 

You can download express editions of different products (Visual Basic 2005, Visual Web Developer 2005). Express editions are light weight products intended for students and hobbyists and their look and feel are very similar to that of Visual Studio 2005 IDE.

READ  SQL Prompt 6.4 Adds New Features and Bug Fixes

Insert Snippet
Applicability – Visual Basic 2005
This feature enables you to add full code snippet to your project. In order to see this in action, start a new Windows Application project by choosing the Visual Basic project type from within Visual Studio 2005. Add a Button control and double click on it to open the code window. Right click on the designer and select Insert Snippet menu from the popup menu (See Figure 8)

microsoft, visual studio, msdn, visual c#, asp.net

Upon selecting the above option, an IntelliSense window pops up with various options (See Figure 9)

microsoft, visual studio, msdn, visual c#, asp.net

These options enable you to add code snippets for performing a wide variety of tasks such as Accessing Databases, Performing Math operations and much more. Upon double clicking an option, the IDE will produce another set of IntelliSense window as per your selection.

For the purpose of this article, I have selected Processing Folders, Drives and Files option. You will be presented with an option box and the corresponding code as shown in Figures 10 and 11.

microsoft, visual studio, msdn, visual c#, asp.net

microsoft, visual studio, msdn, visual c#, asp.net

Even though Visual Studio provides this useful feature, you have to sometimes tweak the inserted code snippet to suit your requirements. You can also learn how to achieve various tasks by studying the code provided by this functionality.

Essential Resources

Visual Studio 2005 Beta Home
Visual Studio 2005 Product Feedback Center
MSDN Documentation for Visual Studio 2005
The .NET Show: Introduction to Visual Studio 2005
Visual Studio 2005 Express Beta Products

Related Books

Introducing Microsoft Visual Basic 2005 for Developers
Introducing Microsoft ASP.NET 2.0

READ  Working with Multiple Forms using Visual C# 2008

Conclusion

As you can see from the above explanations, Visual Studio 2005 greatly simplifies the costly development time of developers than its previous versions. There are many features available with Visual Studio 2005 Beta 1 and it is not possible to discuss all of them in an article. I suggest you to refer to the essential resources listed above if you require further information regarding Visual Studio 2005.

[tag]microsoft, visual studio, msdn, visual c#, asp.net[/tag]

Leave a Reply

Your email address will not be published.