Posts Tagged ‘Regions’

Working with regions using CodeRush

February 6th, 2011 Comments off

If you heavily use region directives in CSharp, Visual Basic, or C++, the following CodeRush features may help you to make it easier to work with them:

Creating regions:

Read more…

Coding Helpers – Move to Region

February 3rd, 2011 Comments off

The Move to Region (also known as Member MoverCodeRush feature extends the Member drop down menu with a menu item that allows you to move the active member to a region according to your preference:

CodeRush Member Icons and Move to Region preview

Read more…

Code Templates – Region Directives

January 29th, 2011 Comments off

Here is the list of CodeRush region-specific code templates. All the templates below generate common regions. Nearly all of them start with “re”, and are followed by a few letters that describe the region to create. These templates also include the “er” template that generates an #endregion directive.

Note that to create regions for specific members, you can use the CodeRush AutoCreateRegion action (by default bound to Ctrl+3), that will create a region around the current property, method, or event automatically.

Read more…

Unbound Actions – Toggle Region

January 27th, 2011 Comments off

The ToggleRegion action changes the collapsed state of the currently active region. This functionality is very similar to the existing “Toggle Regions Outlining” shortcut, provided by CodeRush. The only difference is that you can collapse the active region using the ToggleRegion action when the editor caret is located anywhere inside of a region, while the “Toggle Region Outlining” shortcut is available only on the line with a region directive. The action is not bound to any key, so you might want to do it via the Shortcuts options page in the Options Dialog.

Products: CodeRush Pro
Versions: 11.1 and up
VS IDEs: any
Updated: Aug/30/2011
ID: C061

Coding Helpers – Toggle Regions Outlining

January 27th, 2011 Comments off

When the editor caret is on the line with a region directive, you can press the Space key to collapse or expand the outline of a region. There are built-in shortcuts for toggling outline expansion, but they are probably more tricky to press and remember, e.g. “Ctrl+M, M” (hold the Control key and press the M key twice in the Visual C# keyboard mapping scheme).

CodeRush Toggle Region Outlining

Read more…

Code Providers – Remove Region Directives

January 26th, 2011 Comments off

This simple code provider, as the name says, removes the two lines of region directives:

  • #region and #endregion lines in CSharp
  • #Region and #End Region lines in Visual Basic
  • #pragma region and #pragma endregion lines in C++

It is available on any of the two directives – either starting or ending:

Read more…

Coding Helpers – Auto Create Region

January 26th, 2011 Comments off

If you prefer your code to be wrapped into region directives (#region … #endregion in CSharp, or #Region … #End Region in Visual Basic), the Auto Create Region feature from CodeRush will help. To create a named region around a method, property or event, press “Ctrl+3” key anywhere inside of an active member. This will execute the “RegionAutoCreateaction, which wraps the active member into region directives. The region name will be the same as member’s name and will wrap all attached elements, such as XML doc comments or attributes as well.

Read more…