tags:

views:

28

answers:

1

Hey all,

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!

A: 

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.

Bernard