DisplayFormat property specifier details
- Last UpdatedSep 25, 2023
- 1 minute read
|
Specifier |
Type |
Format |
Example Output (Passed Double 1.42) |
Example Output (Passed Int -12400) |
|---|---|---|---|---|
|
c |
Currency |
{0:c} |
$1.42 |
-$12,4000 |
|
d |
Decimal (Whole number) |
{0:d} |
System Format Exception |
-12400 |
|
e |
Scientific |
{0:e} |
1.420000e+000 |
-1.240000e+004 |
|
f |
Fixed point |
{0:f} |
1.42 |
-12400.00 |
|
g |
General |
{0:g} |
1.42 |
-12400 |
|
n |
Number with comma for thousands |
{0:n} |
1.42 |
-12,400 |
|
r |
Round trippable |
{0:r} |
1.42 |
System.Format.Exception |
|
x |
Hexadecimal |
{0:x4} |
System.Format.Exception |
cf90 |