您的位置:首页 > Web前端

Cool Features I Like About Visual Studio 2005 "Whidbey"

2004-08-23 09:25 387 查看

Introduction

A few hours ago, I installed Visual Studio 2005, aka "Whidbey." So, I thought, "why not share this knowledge with you guys?" In this article, I will share my first Whidbey experiences with you. We will go through the installation process together. I will also present some screenshots that are important to the new features. After that, we will start Visual Studio for the first time and see the new features. I have not started Visual Studio yet because I want to do this together with you.

Installing Whidbey

It took me approximately 50 minutes to install Whidbey on my laptop. My laptop contains an AMD Mobile processor with 1.4 GHz and 512 MB RAM. The following components were installed:

ComponentSpace Required
Microsoft Data Access Components 9.03.10 MB
Microsoft .NET Framework 2.0137.00 MB
Microsoft Visual J# .NET Redistributable Package 2.049.50 MB
Microsoft Visual Studio Enterprise Architect Edition 20051.67 GB
For these components, you will require 2.4 GB space on your HD. After this part of the installation is complete, you have the opportunity to install the MSDN library. You can choose among the following options:

InstallationSpace Required
Full1.9 GB
CustomDepends on your choice
Scoped (recommended)412 MB
For my purposes, I chose the recommended option, Scoped. It took only nine minutes to install the MSDN.

Uninstalling Whidbey

Uninstalling Visual Studio didn't take much time—only 18 minutes and it was gone. The uninstaller removed most installed components except the Microsoft Data Access Components. If you try to uninstall this component via the Add/Remove Programs panel, you will see a window with two options. The first one helps you to re-install this component and the second one, to remove, is not selectable. It shows the following message, "Remove (use mdacrb.exe to do remove)", which is at the following location:

C:/Program Files/Common Files/Microsoft Shared/MDAC Rollback/

Uninstalling this component took only five minutes. If you uninstall Visual Studio, don't be surprised that MSDN is still on your HD. Uninstalling MSDN also took me only five minutes. Of course, this depends on which option you chose when you installed the MSDN.

The Look and Feel of Visual Studio 2005 ("Whidbey")

Now that we have discussed the installation and requirement issues for Visual Studio 2005 ("Whidbey"), let us start Visual Studio for the first time. When you start Visual Studio for the first time, you will see the following window:



Here, you will have to choose your primary development language before Visual Studio can start. After selecting the language, you will see the new IDE. The new IDE does not contain any welcome window with your projects, as in Visual Studio .NET 2003. The new look of the IDE is really nice; nevertheless, you need to get used to it, especially with the dark-grey colors.



Docking Windows

While playing with the IDE, I discovered a very cool feature. When you drag the output bar, some arrows appear in the middle, top/bottom, and left/right. Just drop the output bar over one of the arrows and it will be placed there. This can be done with any bar you can see in the IDE, whether it is the solution explorer, the dynamic help, or anything else—it does not matter.



Do you see the hidden toolbox in the screenshot above, on the left side? This is a feature that also applies to each bar. Just right-click on any bar and select auto hide; it will disappear if you don't need it! For example, if you need the solution bar, just hover over the hidden bar and it will appear.

Intellisense/Intellitasks

I heard a lot of hype about the extended features of Intellisense in Visual Studio 2005, but unfortunately I could not get them to work for me. A simple CTRL + Space didn't work! I could not understand the problem. However, the solution was simple. After installing Visual Studio, I didn't reboot my system. After a reboot, the CTRL + Space key combination worked.

Intellisense is not a new a feature in Visual Studio; however, it is extended. For example, Intellisense also will be available in the web.config files.

Intellitasks are new in this version. Intellitasks enable you to use common code in your projects. At first, I didn't get how they work, but after some research on the Net, it was clear. For example, you can type for and press the Tab key two times; the specified code snippet for the shortcut will be added to your code. If you want to add your own snippet to the Intellitask feature, you can do it through the Code snippet manager (Tools menu -> Code snippets manager). You define your own snippet within an XML file. If you haven't seen a defined snippet before, here is the Class snippet:
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippet Format="1.0.0">
<Header>
<Title>class</Title>
<Shortcut>class</Shortcut>
<Description>Expansion snippet for class</Description>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
<SnippetType>SurroundsWith</SnippetType>
</SnippetTypes>
</Header>
<Snippet>
<Declarations>
<Literal default="true">
<ID>name</ID>
<ToolTip>Class name</ToolTip>
<Default>MyClass</Default>
</Literal>
</Declarations>
<Code Language="csharp" Format="CData"><![CDATA[class $name$
{
$selected$$end$
}]]>
</Code>
</Snippet>
</CodeSnippet>

Refactor

Refactor is also a very nice feature. With Refactor, you can extract methods, encapsulate fields, reorder parameters, remove parameters, surround with common statements, insert expansions, and much, much more.

Let's take a look at extract method. With this feature, you can mark some code and create a new function. The marked code then will be moved to the new function and the new function will be called from the place where the original code was placed. To achieve this, mark the desired code, press the right mouse button, and select Extract Method from the Refactor menu—as shown in the following screenshot.



After that, a new window will appear where you can enter the new name of the function. You cannot change the function to public nor you can add parameters to the function. If you want to do this, you have to edit the function manually. All you can specify is the name of the function.



After pressing the OK button, your code should be changed to the following:



As you can see, this is a very useful feature, especially when you need to move your existing code from one function to a new one. Another useful feature is Surround With. It allows you to surround some code with some common code statements, such as if..else, try..catch, and so forth. So, if, for example, you have the following code:



and use the menu shown in the screenshot above, you will get the following result.



There is also feature called rename; it lets you rename your objects, variables, and so on. To learn a bit more about the rename feature, let's consider an example. When I first worked with this feature, I created a variable in my class—outside of a function. Then, I placed an initialization in a function called "Form1". After that, I used the feature on the declaration and what happened is that it only changed the declaration name, not the variable name in the function. After playing a bit more with that feature, I placed the declaration also in the Form1 function and again used the feature. This time, both variable names were changed.

Conclusion

This was just a short introduction to what I have done so far with Visual Studio 2005. However, there are many more features included and, to describe all of them, I would need to write a book. I hope that you all have enjoyed the first view and experience with Visual Studio 2005, aka Whidbey.

Copyright © Sonu Kapoor 2004. All rights reserved by Sonu Kapoor.

About the Author
Sonu Kapoor has worked with many technologies - like VC++, VC++.NET, ASP, ASP.NET, C# etc.. Besides his programming passion he is a regular column writer for CodeGuru.com and Developer.com. He is currently working as a content editor at XMLPitstop.com - A very large XML resource. Visit his blog for some of his latest thoughts and work.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐