Using:
String output = MyString.ValueType.ToString("N");
The format specifier "N" will be placed in thousands separators (,). See Decimal.ToString (string) for more details.
Edit:
The above will use your current culture settings, so thousands separators will depend on the current locale. However, if you want it to always use a comma and period for the decimal separator, you can do:
String output = MyString.ValueType.ToString("N", CultureInfo.InvariantCulture);
This will force him to use the InvariantCulture, which uses a comma for thousands and a period for decimal separation, which means you will always see โ1,234.5โ.
Reed copsey
source share