| Format Specifier | Description |
|---|---|
| C or c | Formats the string as currency. Precedes the number with an appropriate currency symbol ($ in the US). Separates digits with an appropriate separator character (comma in the US) and sets the number of decimal places to two by default. |
| D or d | Formats the string as a decimal. Displays number as an integer. |
| N or n | Formats the string with commas and a default of two decimal places. |
| E or e | Formats the number using scientific notation with a default of six decimal places. |
| F or f | Formats the string with a fixed number of decimal places (two by default). |
| G or g | General. Formats the number normally with decimal places or using scientific notation, depending on context. If a format item does not contain a format specifier, format G is assumed implicitly. |
| X or x | Formats the string as hexadecimal. |
Reference: Visual C#® 2005: How to Program, Second Edition
No comments:
Post a Comment