开发者

Why StyleCop rule does not allow using #region in code?

I get the warning as below screenshot and I don't understand why it would be treated like that. I often need to开发者_运维百科 "regionize" my codes.

What do you think?

Why StyleCop rule does not allow using #region in code?


While it is true that this StyleCop rule is just a recommendation, I would not disable it though. More often than not, these #region blocks are used as a visual and reading aid. It is usually a sign that a certain function or subroutine is too long and/or composed of multiple parts. You can use this as a guide or trigger to refactor that very long code.


The default StyleCop rules are not set in stone.
I don't remember the link anymore, but someone from the StyleCop team once said that the default rules are just suggestions.

So feel free to disable rule SA1123 if you don't like it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜