Click here to Skip to main content
14,358,895 members
Rate this:
Please Sign up or sign in to vote.
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}??
Posted

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

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!
   
Comments
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, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100