Visual Studio: Cool keyboard shortcuts

Updated: 2013-09-05

A few cool Visual Studio 2008 keyboard shortcuts…

Track Content in Solution Explorer

Tools – Options – Project & solutions – Select “Track Active Item in solution Explorer”

Shortcut for switching to Solution Explorer (e.g. for showing file properties) here after: Ctrl-Alt-L

View: C# code editor.
Keyboard shortcut: Ctrl+.
Invokes: SmartTag

Case 1 – Add not implemented method

When you know you need a method and know its signature then just write it. When you write the last “)” then an underscore appears (SmartTag) under the first letter of the method.

Now press Ctrl+. => a choise appears. You can now choose to have a method written for you:

Case 2 – Add missing namespace

When you have written a class name of an existing class – without entering the namespace and the namespace is not added with “using” then – when last letter is written – an underscore appears (SmartTag) under the last letter.

Now press Ctrl+. => choises appears. You can now choose to add “using …”

or you could choose to add the namespace in front of the class.

In both cases the class will appear as a known class to the compiler (without the red error sawtoothed line underneath).

View: C# code editor.
Keyboard shortcut: Ctrl+k,x
Invokes: Snippets

With the above shortcut, you get a tree like menu, so you can drill your way down to a code snippet you need.

Faster is it though to write the beginning of the snippet (ie. prop) then  press tab twice and you’ll get your snippet.

View: C# code editor.
Keyboard shortcut: none – write override
Invokes: intellisence for finding events

You are inside a class and want the signature for an overriden event. You just write override and select the event from the intellisence list.

Links

http://www.vishalseth.com/page/Visual-Studio-2008-Keyboard-Shortcuts.aspx

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: