Jonas Stawski

Everything .NET and More

Visual Studio 2008 Shortcut for adding using statements

A couple of weeks ago I attended a very good session about the Entity Framework given by Shawn Wildermuth. He showed us something that I thought was only possible with Resharper. He typed a class name and since he wasn't using the fully qualified name of the class he was getting the typical Visual Studio hightlight warning ("If you compile me I will complain"). He moved the cursor over the class and press some shortcut and voila Visual Studio added the using statement at the top. Being the type of guy I am, I thought cool, mental note the shortcut and I will use it later. Of course today I wanted to use the shortcut and I didn't remember what it was. So searching for it in google I came across David Hayden's post which explains how to use the shortcut.

Just some clarification from David's post. I am such a schmock that when David says "CTRL + ." he actually means to press the control key and the period. The period is actually part of the shortcut, not the end of the sentence. I was pressing the control key and the plus sign and it wasn't working.

Another clarification. David says to add the Edit.RemoveAndSort command as a shortcut. To do so, go to Tools - Customize and press the "Keyboard..." button. Again, don't be like me and once you find the actual command and set the shortcut click on "Assign" before pressing "OK".

Happy Shortcutting

Comments (1) -

Thanks Smile Was looking for this..


Add comment