I am working on someone else’s code, and see things like:
if ((somevariable) > decimal.Parse("24,999.99")) ...
and
return int.Parse("0");
I cannot think of any logical reason to do this instead of
if ((somevariable) > 24999.99) ...
or
return 0;
What am I missing?
There is a semantic difference between the original code and your proposed change, but you’re right in being skeptical.
The conversion from a string is just plain stupid, sorry. There is no need to do that, ever. The difference is that the original code parses the string as a
decimal, but your change would use adouble. So, it should be: