Formatting Strings In C# - Numbers With Commas

September 7th, 2007 | by programming |

To display number with commas, so it would look like:

1,200,000

instead of

1200000

you can use String.Format() method.

For Example:

int number = 1200000;
Response.Write(String.Format("{0:#,0}",number));

Post a Comment