Using String.Format method in C# to add commas in thousands place for a Number

If you need to add a comma in the thousands place for a number using the String.Format method in C# , you can use the format specifier N as shown in the below code snippet.

Using String.Format method in C# to add commas in thousands place for a Number

int number = 109711;
string retVal = string.Format("{0:n0}", number);
Console.WriteLine(retVal);
Console.ReadLine();