C#C
C#2y ago
wilbertom

Does CultureInfo ever matter here?

I have some code that is generating some warnings:

CA1305: The behavior of 'long.ToString()' could vary based on the cu
rrent user's locale settings.


My software does run under different locale settings but I don't think long.ToString() are ever displayed differently.

Am I correct in thinking it doesn't matter here?

Iterating all cultures, I see that they all output the same thing:

long i = 1000000000000;

foreach (var culture in CultureInfo.GetCultures(CultureTypes.AllCultures))
{
    Console.WriteLine(i.ToString(culture));
}
Was this page helpful?