It is a sort of format specifier for formatting numeric results. There are additional specifiers on the link.
What N
does is that it separates numbers into thousand decimal places according to your CultureInfo and represents only 2 decimal digits in floating part as is N2
by rounding right-most digit if necessary.
N0
does not represent any decimal place but rounding is applied to it.
Let's exemplify.
using System;
using System.Globalization;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
double x = 567892.98789;
CultureInfo someCulture = new CultureInfo("da-DK", false);
// 10 means left-padded = right-alignment
Console.WriteLine(String.Format(someCulture, "{0:N} denmark", x));
Console.WriteLine("{0,10:N} us", x);
// watch out rounding 567,893
Console.WriteLine(String.Format(someCulture, "{0,10:N0}", x));
Console.WriteLine("{0,10:N0}", x);
Console.WriteLine(String.Format(someCulture, "{0,10:N5}", x));
Console.WriteLine("{0,10:N5}", x);
Console.ReadKey();
}
}
}
It yields,
567.892,99 denmark
567,892.99 us
567.893
567,893
567.892,98789
567,892.98789