views:

367

answers:

17

The nuance of the question is what are the features of the Visual Studio environment, that not everyone knows about, that you have come to depend on and that you would like others to know about.

+2  A: 

Control+minus : goes back to the previous editor position. This is especially helpful if you have temporarily navigated away from your editting position because you've looked up a symbol declaration or searched for a string. It works between files too. Control+Shift+minus visits the editor positions in the opposite direction.

Geoffrey Chetwood
A: 

The ability to unload projects and then to edit them using the text editor. You do this by right-clicking on a project and selecting "Unload Project", the right-clicking on the project and select "Edit project". Sometimes editing the text of the project files is faster than carrying out operations using the gui. For example, having to copy a long list of references from one project to another. Once the editing is done, you right-click on the project and select "Load Project" to return to the normal project view.

Geoffrey Chetwood
+2  A: 

Dragging the current location marker in the source window during a debug session to skip statements or re-execute statements. In the debugger the yellow "current statement" arrow is draggable.

Geoffrey Chetwood
A: 

Executing C# statements interactively in the debugger using the Immediate Window. You can type statements into the Immediate window of the debugger, and it will execute them in the context of the current statement. Of course, only statements that make sense in the context of the current statement will execute.

Geoffrey Chetwood
+2  A: 

In C++, a really handy thing to have is to open the "Code Definition Window". So no matter what .cpp file you are editing, the corresponding .h window is displayed in this extra window.

Geoffrey Chetwood
A: 

Leaving bookmarks in your code, with Ctrl + K + K, then you can navigate to the next bookmark with CTRL + K + N , and to the previous with CTRL + K + P.

CMS
+1  A: 

Ctrl + . to automatically show smart tags, so Ctrl +. then enter will quickly open and use the smart tag value.

johnc
A: 

Interactive search with Ctrl+I is great for fast searching through a file.

Mike Hall
+1  A: 

Ctrl + K + C to comment out a selection

Ctrl + K + U to uncomment a selection

Ctrl + . for smart tags

Ctrl + space to bring up intellisense

I also like to use the prop and foreach code snippets.

Andrew Van Slaars
A: 

Highlight all your using statements in VS 2008 and go to Edit -> IntelliSense -> Organize Usings -> Remove Unused Usings :-)

IrishChieftain
You can do this from the right click context menu in a code window too. You don't have to highlight the using statements, either.
+3  A: 

I'd recommend you check out the Webcast for session TL46 from PDC 2008: Microsoft Visual C# IDE: Tips and Tricks. The speaker points out some non-obvious things, and also talks about the free, recently released "express" version of CodeRush and some of the things that it can do.

http://channel9.msdn.com/pdc2008/TL46/

+1  A: 

Ctrl + K + F to format a selection.
Fixes all my crappy indenting messes.

David HAust
Another similar tip is to delete a }, and add it again. It will also reindent the code.
Frode Lillerud
+3  A: 

The best tricks I find come across Sara Ford's blog - http://stackoverflow.com/questions/100420/hidden-features-of-visual-studio-2005-2008#100457

Slace
A: 

Install R# ;-)

mookid8000
A: 

Ctrl+K, Ctrl+C to comment out the selected block of text. Ctrl+K, Ctrl+U to uncomment the text.

Priceless.

j0rd4n
A: 

Ctrl K + D, formats code-behind AND HTML (Indenting, etc)

It is my new favorite trick.

Also, I use ctrl + m + o frequently, which collapses all methods.

+1  A: 

Ctrl + Alt and mouse select allows vertical selection of characters.

Brad