wilbertom
wilbertom
CC#
Created by wilbertom on 1/18/2024 in #help
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.
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));
}
long i = 1000000000000;

foreach (var culture in CultureInfo.GetCultures(CultureTypes.AllCultures))
{
Console.WriteLine(i.ToString(culture));
}
6 replies