您最喜欢的 FxCop 规则是什么?

发布于 2024-07-13 22:11:18 字数 44 浏览 7 评论 0原文

您最看重哪些 FxCop 规则? 哪些规则突出了 .Net 的最佳陷阱?

Which FxCop rules do you most value? Which rules highlight the best .Net gotchas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

記柔刀 2024-07-20 22:11:18

我最喜欢的 FxCop 规则是那些在编译代码时不会给出错误的规则。

My favorite FxCop rules are the ones that don't give me errors when compiling my code.

一场信仰旅途 2024-07-20 22:11:18

您最看重哪些 FxCop 规则?

我要写的内容是为了阻止开发人员使用 #defines 而不是配置(需要引用:使用预处理器是不好的 OO 实践)。
我喜欢几乎所有的设计规则。

Which FxCop rules do you most value?

The one I am going to write to stop developers from using #defines instead of configuration (Quote needed: Preprocessor usage is bad OO practice).
And I like almost all of the design rules.

羁拥 2024-07-20 22:11:18

我发现一些用法和设计规则特别有帮助。 我永远记不起如何实现 IDisposable 或 ISerialized 接口的细节,因此我很感谢这些规则的温和提醒:

I find some of the usage and design rules particularly helpful. I can never remember the details of how to implement the IDisposable or ISerializable interfaces, so I appreciate the gentle reminders from rules like these:

看轻我的陪伴 2024-07-20 22:11:18

我最看重并且突出了陷阱的规则是性能规则。

The ones I value the most, and which highlight the gotchas, are the Performance rules.

季末如歌 2024-07-20 22:11:18

这不是 FxCop 规则,而是 NDepend 代码查询语言规则,但尽管如此,我还是喜欢CQL规则:

// <Name> Make sure refactored and added methods are covered by tests</Name>
WARN IF Count > 0 In SELECT METHODS WHERE 
PercentageCoverage < 100
AND (CodeWasChanged OR WasAdded)

This is not a FxCop rule but NDepend Code Query Language rule, but nevertheless, I love the CQL rule:

// <Name> Make sure refactored and added methods are covered by tests</Name>
WARN IF Count > 0 In SELECT METHODS WHERE 
PercentageCoverage < 100
AND (CodeWasChanged OR WasAdded)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文