If you read about Regionerate in blog posts, you are most likely to read that it is "a tool that creates regions automatically".
Most people don't understand that Regionerate is primarily about Code Layout and that #region is just one display style. Currently, Regionerate has 3 types of regions - Visible, Invisible and Comment.

If you take a look at the Code Layout schema, you can see that the CreateRegion statement has an attribute called RegionStyle which accepts any of the values mentioned above.
  • The Visible region style is the default style which will wrap your selection with #region-#endregion, for example:
#region Private Fields (3)

private string a;
private string b;
private string c;

#endregion
  • The Comment region style is a simpler style which will display a comment at the beginning of the selection, for example:

// Private Fields (3)

private string a;
private string b;
private string c;

This region style is very useful for regions inside regions which typically have a small amount of elements. For example:

#region Methods (3)

// Public Methods (2)

public abstract void A();
public abstract void B();

// Protected Methods (1)

protected abstract void C();

#endregion
  • The Invisible region style will display only the selected items without any header or footer, for example:

private string a;
private string b;
private string c;

This region style is ideal if you want to keep your code under a specific layout, but can't stand expanding and collapsing those annoying #regions.

Labels: , ,

0 comments. Add a comment.