Regions are great for collapsing a bunch of code into a single line. Combined with Resharper, you can just select a whole bunch of code, hit Ctrl+J (Surround With), Region, and voila – it’ll automatically add the #region and #endregion keywords around the selected text.

It’s annoying that there’s no keyboard shorcuts to collapse and expand specific regions. It would be great if when the cursor was inside a region, I could use a shorcut to collapse it. Anyone know of a way to do this?

Update: Ater Googling around a little bit, I found Tips and tricks for the Visual Studio .NET IDE which provided the answer: Outlining.

  • Fold/Unfold the current code block – Ctrl+M, Ctrl+M
  • Unfold all – Ctrl+M, Ctrl+L
  • Stop outlining – Ctrl+M, Ctrl+P
  • Fold all – Ctrl+M, Ctrl+O