Organize Usings in VS2008
 
In my demos you will never find superfluous using statements at the top of code files. When I am trying to explain some new API, I want it to be very clear what namespaces are being used. I have seen many other presenters that leave in there every namespace under the sun and it always annoys me. The other thing I try and do is remove references to assemblies that I am not using (for the same reasons). In fact, I used to do both of these even in real projects; even though there are zero performance implications for either, it just felt cleaner to me.

Now with VS2008 the manual process of removing namespaces is taken care for you. Simply right click in a code file and you see a new option as shown here:


Great! I am not so sure about sorting though. It sorts alphabetically and perhaps that is a good idea now that I think of it, but I am used to sorting my namespaces by length from shortest to longest so a nice triangle is visually formed (yes, I am weird, I know). More seriously, I usually just leave the last namespace I imported appear at the bottom of the list...

The sad thing is that this feature only takes care of using statements and NOT of assembly references as hinted in my opening paragraph. The ironic thing is that while this is a new C#-only feature, in VB (even with VS2005) you can indeed remove unused assembly references from the project properties. If only the two teams talked to each other and both decided to implement the other's complementary feature...
foreach uses var
 
Whenever I want to loop through a collection of some sort, in C# I type foreach and hit the TAB key twice (to invoke the code snippet). This gives me the following code template:
    foreach (object var in collection_to_loop)
    {
     
    }
...where object is highlighted so you can change it to the real type of your collection, var is highlighted so you can change it if you wish to have your own variable name and collection_to_loop is highlighted so you can change it to your actual collection variable name.

This always looked awkward to me when playing with LINQ since I typically use the keyword var to replace the object and then immediately I am confronted with var as the variable name that I change only so the awkwardness can go away.

In Visual Studio 2008 Beta 2 you get the following with the foreach code snippet:

No awkwardness, automatic use of local variable inference and, generally speaking, only one item to replace: collection.

Are you revisiting your own code snippets making them more user friendly?

 

snippet
 
Hot on the trails of the improvement in the foreach code snippet in VS2008, I found that the prop snippet also changed:

Yup, automatic properties by default ;)

Transparent Intellisense
 
While no doubt everyone will be talking about VB intellisense that I’ve mentioned before or the Javascript intelisense, I just discovered another small improvement in the Orcas IDE.

You will recall that VS2005 introduced DataTips (debugger tooltips on steroids) and when you hold down the Ctrl key they become transparent. Well, that is now true as of Beta 1 for the intellisense window too! In the screenshot below, the left side is what you would face today but with Orcas Beta 1 hold down the Ctrl key and you can see what is below the intellisense window without having to close it, as shown on the right:


I wonder how many people will discover that. It reminds me of another little known feature introduced in VS2005, which I still encounter people today not knowing about: ability to resize the intellisense window... try it if you haven't!