Cover

My Favorite Visual Studio Shortcuts and Snippets

July 22, 2009
No Comments.

I’ve been speaking at user groups and conferences for a long time now. Usually at these short talks I don’t get asked much about how I use Visual Studio.  But now that I am teaching Silverlight, my students are never shy about asking what I am doing while in Visual Studio.  I am often amazed by how people use Visual Studio without learning some of my favorite hotkeys/snippets.  Here are some of mine:

Keyboard ShortCuts

  • Ctrl-Shift-B: Build Solution
  • Ctrl-. (period): Show “Add Using/Imports” dropdown for unknown types.
  • Ctrl-K, C: Comment Selection
  • Ctrl-K, U: Uncomment Selection
  • Ctrl-K, F: Format Section
  • Ctrl-K, D: Format Document
  • Ctrl-Space: Show Intellisense List
  • Ctrl-Shift-V: Paste Loop - Hit Multiple Times to paste through the list of recent ‘copies’
  • Ctrl-F: Simple Find
  • Ctrl-Shift-F: Find in Files
  • Ctrl-H: Simple Replace
  • Ctrl-Shift-H: Replace in Files
  • Ctrl-N: New->Project Item
  • Ctrl-Shift-N; New Project
  • F9: Set Breakpoint
  • Ctrl-Shift-R: Start/End Temporary Macro Recording
  • Ctrl-Shift-P: Play Temporary Macro Recording
  • F12; Navigate to Type (or metadata for Type) under the cursor

Snippets

(To use these snippets, type the phrase and hit Tab twice)

  • prop: Create a simple property in a class
  • **propg: **Create a simple property with a public get and a private set
  • foreach: Create a foreach block
  • sldpc: Create a Silverlight Dependency Property*

* This snippet is from the Silverlight Contrib snippet collection.

What are yours?