Kirill's Visual Studio Tips
I decided to compile a small list of Visual Studio features that I use a lot.
Code Editor
- Code Snippets for ‘prop’, ‘foreach’, ‘if’, ‘class’, ‘interface’, Tab-Tab completion
- Surround with (snippets) - try, if
- Ctrl+K,D – FormatDocument
- Ctrl+Left/Right arrows in code editor – jump between words faster
- Ctrl+K,C – Ctrl+K,U – comment/uncomment selection
- Dynamic Snippets in the XML Editor - I bet a lot of people don't know about this one
Navigation
- F12 (Go To Definition) – position the caret on an identifier and hit F12
- Shift+F12 (Find All References) – then hit F8 to step through the results in the Find Symbol results window
- Click the “back” button on the Microsoft Explorer mouse with your thumb navigates back (under C# profile)
- Right-click on a document Tab – Copy Full Path, Open Containing Folder
Refactoring
- Position the caret on an identifier and hit F2 (Refactor -> Rename)
- Extract Method (Context Menu)
Code generation
- Generate Method Stub (Smart Tag) - Ctrl+. and enter
- WindowsContextMenuButton + O + ENTER + A – quick way to organize, remove and sort usings
Debugging
- Debug -> Exceptions (allows breaking on a first-chance exception)
- Right-click on a breakpoint brings up a context-menu which not everyone knows about ;-)
- Tools -> Options -> Debugging -> Enable just my code
- Attach to process -> Cross Platform Debugging (Managed, Native)
- .load sos, !clrstack, !dumpheap, !gcroot, etc.
Solution Explorer
- Tools -> Options -> Projects and Solutions -> Track Active Item in Solution Explorer
- Right-click on an item in Solution Explorer – Open Folder in Windows Explorer
- Right-click on a project -> Unload -> edit .csproj file in XML
Macros and automation:
- Coding productivity: macros, shortcuts and snippets
- How to map a Visual Studio macro to a keyboard shortcut?
P.S. Sara Ford has much much more in her famous Did you know series.