StyleCop SA1124 DoNotUseRegions is reasonable?

Yanhua picture Yanhua · Mar 12, 2010 · Viewed 6.9k times · Source

SA1124 DoNotUseRegions suggest that region should not be used anywhere. Is it really reasonable?

I think region is a way to group relative code together and make large class easy to read, for example, if you generate interface method for a class in vs2008 via context menu, a region will be automatically inserted.

I would like to remove this rule while checking code style. May I know your opinions on this rule?

Answer

mheyman picture mheyman · Oct 12, 2011

There is no more need for regions in well written code. It once was useful to hide machine generated code. Now that code goes in a separate file. Regions can still be used to hide poorly written code.