开发者

FxCop rule for string ==?

开发者 https://www.devze.com 2023-01-13 21:24 出处:网络
Can anyone point me to an fxcop rule for identifing \"string ==\" usage. For example: 开发者_开发技巧string s = \"abc\";

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!


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.

0

精彩评论

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