Turning Off Regions in ReSharper

Home/.Net/Turning Off Regions in ReSharper

I’m not a fan of seeing regions in my code and, by default, ReSharper is configured to group members (methods, interface implementations, etc) with regions when running the Code Cleanup utility. I’ve turned this off a couple of times but it usually takes some poking around until I remember what to do again.

From within Visual Studio, open ReSharper –> Options.

Then, under Languages –> C#, select “Type Members Layout”

TypeMembersLayout

Uncheck the “Use Default Patterns” checkbox

UseDefault

Throughout the XML configuration document, you’ll notice various “Group” nodes which are used to create regions for specific element types. Deleting all these nodes will keep ReSharper from adding regions when running Code Cleanup.

Groups

If you really dislike regions, you can also configure ReSharper to remove all existing regions as well. Find the default pattern node…

DefaultBefore

…and add a flag to remove all regions.

DefaultAfter

Much better!

Tags: , |

About the Author:

Freelance software developer in the Cleveland area.

One Comment

  1. Matt July 28, 2010 at 6:04 am - Reply

    Thanks – personally I hate regions. IMHO if you need them, your classes are too big.

Leave A Comment