Should FxCop "indicate iformat provider" to catch Int32.TryParse violations?

The FxCop Globalization Rule, "Specify an IFormat Provider," does not block Int32.TryParse violations for me. Is this a mistake, or am I doing something wrong?

+3
source share
1 answer

Most likely, because Int32.TryParse without additional parameters will refuse to parse strings containing group separators or decimal separators:

Int32.TryParse("1.234", out temp);  // => false
Int32.TryParse("1,234", out temp);  // => false
Int32.TryParse("1234", out temp);   // => true, temp = 1234

Thus, Int32.TryParse is probably not considered culture sensitive with FxCop.

+1
source

Source: https://habr.com/ru/post/1715947/


All Articles