0

I recently learned the perils of comparing double values. Now, I want to find all of the double comparisons in our rather large c# codebase so that I can replace them. I've been doing this using full text searches, hunting and pecking through the results, but I'm worried that I might missing something. Plus it takes a long time. Is there a better/smarter way to do this?

In short, I want to find any places in the code where there is a double value on either side of a comparison operator: ==, <, <=, >, >=

should find this if statement:

double d = 5
if(d == 0) dosomething;

but should not find this if statement

int i = 5
if(i == 0) dosomething;
Mark Bell
  • 384
  • 2
  • 8

0 Answers0