Visual Studio Tips and Tricks - I

As a developer you would always want to write your code faster. But do you think practicing from your Typing Tutor is the ultimate solution. Nah. There are better ways to do it, and some of them is learning your IDE (Integrated Development Environment). This can definitely simplify your coding and automatically speed of your coding. Its quite impossible to list all the tips and tricks of Visual Studio out here, so I have thought of creating a series of blog post which you can latter refer from here.

In this first series, I will basically teach you how to automatically insert the namespace at the using block on the top of your .cs code.

The traditional way to basically insert the namespace would be to navigate to top of your cs code and type using Company.SomeNamespace. Well first of all just using your mouse to navigate at the top, or typing it or even using the shortcut ctrl + home to go to the top already loses lot of time. (well this is computer stuff, so even a second is too slow). If you actually look carefully you will see and underline short of character found under the last letter of your word like this one image. One of the way is to use your mouse and hover over the underline and the following menu would appear, or just use Ctrl + . (Ctrl + period) and press enter as the top one which is System.Diagnostics would be automatically highlighted. This would automatically add the namespace to the top of your .cs code.

Visual Studio 2005

This seems to work perfectly well with Visual Studio 2008 but seems to be a bit broken with Visual Studio 2010 Beta 1. I have posted a feedback about it to Microsoft to fix it. Hope they fix it by RTM. Anyways below is the screenshots of how its done is VS2010 Beta 1. The problem is that in VS2010 beta 1 doesn’t automatically select the first item in the menu like the one VS2008 does. So, for VS2010 Beta 1 you need to use one more button – down arrow key and then enter key. This bug has already been fixed up in the internal builds of VS2010 and is expected to be in effect from the upcoming version of Visual Studio 2010.

For more articles on tips and tricks refer here. Or you can also access the page from the right menu under Page List heading.