Visual Studio 2010: is it possible to syntax highlight all "==" out of conditions?

I just spent hours trying to debug my code. The whole problem came down to the line:

a == b;

when i really wanted

a = b;

Classic and stupid problem. The fact is that my eyes just blurred == every time I checked this section of code.

Is there a way to turn on syntax highlighting (squiggles) for all == outside the conventions?

That is, I want Visual Studio to warn me when I have == outside of if (), while (), for (),?: Etc. This program was in C ++, but I would like the same function to edit C #.

I would agree to something that would allow me to (easily) fix squiggles errors using regex.

+4
source share
2 answers

This does not answer your question, but the question seems controversial, given that the compiler should have given a level 1 warning for this: C4553

+3
source

It is sometimes useful to use operator== for external conditions. Consider:

 bool valuesAreGood = (a == b) && (c == d) && (a < c) ...; if (valuesAreGood) { ... } 
0
source

All Articles