Add comma thousand separator to decimal (.net)

Viewed 49445

I have a decimal number, say 1234.500.

I want to display it as 1,234.5.

I'm currently converting it to a double to remove the trailing '0's.

string.Format("{0:0,0}",1234.500) removes the decimal place, and other formatting options seem to use two decimal places regardless.

Can anyone offer insight?

6 Answers

Try this:

string myNumber = string.Format("{0:#,0.00}", 1234.500);

(I've seen this in RDLC reports)

Related