Sunday, February 20, 2011

Disable #regions in Visual Studio

2 weeks ago I gave a presention for the VISUG. During the presentation I mentioned that I hated the use of #regions in source code.  Each time you use the Visual Studio helpers you will get a region tag around the interface implementations. Someone in the audience mentioned that I could disable this behavior.

So after the presentation I opened Visual Studio again and found the option to disable this:

Tools –> Options… -> Text Editor –> C# –> Advanced –> Implement Interface

image

Deactivate this checkbox and bye bye “#region…”

3 comments:

Shane said...

If you are forced to work with other people's code that already has #regions, you can also use a Visual Studio extension to make them not stand out so much and auto expand: Visual Studio Region Tool.

Jonathan Winters said...

You can permanently get rid of having Visual Studio collapse the regions by unchecking the Outlining checkbox.

Bart Wullems said...

Thanks for the tip guys!