Microsoft has finally released Visual Studio 2005 Beta 1. 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. The current beta 1 edition seems to be very stable and if you explore
the features on it then it would be easy for you to work with its upcoming beta
2 and final edition.
Visual Studio 2005 Beta 1 can be freely
downloaded by clicking
here. The product is also available in the form of CDs 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:
-
Surround With
-
Refactoring
-
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)
Figure 1
You will view a list box with lot of options as shown in Figure 2
Figure 2
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
Figure 3
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.
Figure 4
Code Window before Refractoring
Figure 5
Right click the selected code and choose the Refractor -> Extract Method option.
You will be presented with a dialog box as shown below
Figure 6
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
You can |
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)
Figure 8
Upon selecting the above option, an IntelliSense window pops up with various
options (See Figure 9)
Figure 9
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.
Figure 10
Figure 11
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
Microsoft Press
Introducing Microsoft
ASP.NET 2.0
Microsoft Press
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.
About the Author
Anand Narayanaswamy (Microsoft MVP) works as an independent consultant and runs
NetAns Technologies which provides
affordable and reliable web hosting services for the community. He also runs
Webhostinghotel.com, LearnXpress.com,
Dotnetalbum.com and regularly
contributes articles, product and book reviews for various websites. He can be
reached at ananddotnet@yahoo.co.in