Click here to Skip to main content
15,040,743 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
To display a number with its associated currency symbol and the appropriate number of decimal places we use the currency character “C” or “c”, like:
Console.WriteLine("{0:C}", 1.2");
The number 1.2 appears in the output like this: $1.20.
my question is what does "0" indicates in {0:C}??

1 solution

It referers to the variable (zero-)index in params.
Console.WriteLine("{0:C} {1:C} {0:C}", 1.2, 1.5);

will output:
1.2 1.5 1.2

Good luck!
Abdulmateen50 7-Feb-13 23:55pm
oh thanks !

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900