Last Updated: February 25, 2016
·
444
· aleclanter

#region can be a code smell

I've seen a lot of code using, over-using and abusing the #region directive. Personally, I've never been a fan of it, but it's only been recently that I figured out why.

#region lets you cheat on code compartmentalization.

If your code file is so large that you can't find your way around it without divvying everything up into regions and making copious use of code folding in the editor, you should seriously take a look at the way your class is structured. It probably indicates that you're doing too much in a single class, and need to split things apart.