Specifier | Applies To | Meaning | Example |
---|---|---|---|
C | Numeric types | Financial Value | $4834.50 |
E | Numeric types | Scientific notation | 4.834E+003 |
F | Numeric types | Fixed-point decimal | 4384.50 |
G | Numeric types | General number | 4384.5 |
N | Numeric types | Common locale-specific format for numbers | 4,384.50 |
P | Numeric types | Percentage notation | 432,000.00% |
Example 1: C#.NET Format string
class Program { static void Main(string[] args) { float d = 100000000000/3f; Console.WriteLine("The double is {0:F} ", d); Console.Read(); } }