I've had a request to look into the feasibility of replacing all of the string == operator usages in a reasonably large C# codebase with String.Equals() method calls that explicitly specify case-sensitivity.

Haven't had much luck figuring out a way to identify all the occurrences in the codebase, though.

  • Searching for "==" obviously finds countless instances of types other than strings being compared.
  • There doesn't seem to be a StyleCop rule to find this.
  • Nor a ReSharper rule.
  • As a last resort I tried loading the assemblies into JustDecompile and finding all usages of System.String.op_Equality but that doesn't seem to pick up usages inside of LINQ expressions such as .Where(x => x.StringField == stringField)

So I'm a little stumped and wondered if anyone had any ideas on how to search these pesky comparisons out?

c#
Edit
Report