Devlico.Us
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @devlicious

Christopher Bennage

Our WPF book is now available!
follow @bennage on Twitter!
 


Prevent ReSharper from Adding Regions to Interfaces

This is really a corollary to a post by Kyle Baley a while back.

Despite my original love affair with regions some years back, that are nothing but noise to me now. Unfortunately, the default behavior of R# is wraps interface implementations in a region. I can understand where this might be helpful, but 90% of the time (in my experience) it is not .

I made a couple of half-hearted attempts to turn it off. It is not obvious in the least. After learning how from Kyle's post though, I thought I'd outline the exact steps.

  • Go to ReSharper | Options
  • In the left explorer pane, find Language | C# | Formatting Style | Type Members Layout
  • Uncheck "Use Default Patterns"
  • A huge nasty XML document appears. As Kyle mentions, Don't Panic.
  • Around line 162 is a section marked by <!--interface implementations-->
  • Within <entry />, remove:
<Group>
    <ImplementsInterface Immediate="true" 
                         Region="${ImplementsInterface} Members"/>
</Group>

Here's the screen shot.

Turning off regions for interfaces in ReShaper

Now you are good to go!



Comments

Rob Eisenberg said:

Awesome!
# October 27, 2008 10:43 AM

Adam Vandenberg said:

Thanks for mentioning this, I kept meaning to look into this.

(Just below that section you can do pretty much the same thing to remove regions from nested classes.)

# October 27, 2008 11:21 AM

Kyle Baley said:

It's worth looking at that entire XML in more detail. It will wreak havoc on any NUnit tests you have if you leave it as is.
# October 27, 2008 1:31 PM

About Christopher Bennage

Christopher is a software developer and consultant at Blue Spire Consulting, a company he co-founded with Rob Eisenberg in 2006. He is a Christian, a marginal musician, and an armchair philosopher. His interests include programming, liberal education, science, truth, beauty, and a number of deceased British authors (C. S. Lewis, G. K. Chesterton, and most recently Owen Barfield.) He lives in Tallahassee, FL with his wife and three children and still prefers to play as the Night Elves in WarCraft 3. Check out Devlicio.us!

Our Sponsors

Proudly Partnered With