FxCop 字符串 == 的规则?
谁能告诉我一个 fxcop 规则来识别“string ==”的用法。例如:
string s = "abc";
if (s == "def") {
// do somethign
}
我希望将“if”语句作为错误引发。粗略地说,我希望始终将 string.compare 与适当的区域性一起使用。
谢谢!
Can anyone point me to an fxcop rule for identifing "string ==" usage. For example:
string s = "abc";
if (s == "def") {
// do somethign
}
I want the "if" statement raised as an error. Roughly speaking I want to always be using string.compare with the appropriate culture.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能必须为此编写自己的自定义规则,但这应该不会太难。请参阅此处找到的文件。另外,使用 .NET Reflector 查看 FxCop 库并了解这是如何实现的完成了。
You might have to write your own custom rule for this, but it shouldn't be too hard. Refer to the files found here. Also, use .NET Reflector to look at the FxCop libraries and get an idea of how this is done.