Search code examples
c#stylecop

StyleCop SA1124 DoNotUseRegions is reasonable?


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?


Solution

  • This is going to be a personal preference thing. The only thing that matters here is what you and your team prefer. Forget what StyleCop says, you're the ones reading it, you're the ones maintaining it, whether with or without regions works better for you, that's all that matters.

    If you're releasing it as an open-source project...and this is my opinion here, I think the same applies. Use whatever the core team is more comfortable with. If you get a lot more team members aboard and more contribute, re-visit the issue later, this can always be changed.