You can use ToString along with a format string and a format provider that uses ".". as a separator of groups and determines that the number should be grouped into 3-digit groups (which does not apply to all cultures):
int number = 1000000; Console.WriteLine(number.ToString("N0", new NumberFormatInfo() { NumberGroupSizes = new[] { 3 }, NumberGroupSeparator = "." }));
Fredrik Mรถrk
source share