开发者

FxCop rule for string ==?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜