Stringstr1 = string. Format ("{0: N1}", 56789); // results: 56,789.0
Stringstr2 = string. Format ("{0: N2}", 56789); // results: 56,789.00
Stringstr3 = string. Format ("{0: N3}", 56789); // results: 56,789.000
Stringstr8 = string. Format ("{0: F1}", 56789); // results: 56789.0
Stringstr9 = string. Format ("{0: F2}", 56789); // results: 56789.00
Stringstr11 = (56789/100 .0). tostring ("#. #"); // result: 567.89
Stringstr12 = (56789/100). tostring ("#. #"); // result: 567
C or C
Currency
Console. Write ("{0: c}", 2.5); // $2.50
Console. Write ("{0: c}",-2.5); // ($2.50)
D Or d
Decimal number
Console. Write ("{0: D5}", 25); // 00025
E or E
Scientific type
Console. Write ("{0: e}", 250000); // 2.500000e + 005
F or F
Fixed Point
Console. Write ("{0: F2}", 25); // 25.00
Console. Write ("{0: F0}", 25); // 25
G or G
General
Console. Write ("{0: g}", 2.5); // 2.5
N or N
Number
Console. Write ("{0: n}", 2500000); // 2,500,000.00
X or X
Hexadecimal
Console. Write ("{0: x}", 250); // fa
Console. Write ("{0: x}", 0 xFFFF); // FFFF