March 2004
Intermediate to advanced
560 pages
26h 47m
English
using System;
namespace Samples
{
public class IFormattableSample
{
public static void Main()
{
double d = 123.12345678901234;
string[] strings = {"C","E","e","F","G","N","P","R"};
foreach(string s in strings)
Console.WriteLine("{0:R} as {1}: {2}",
d, s, d.ToString(s,null));
strings = new string[]{"D","x","X"};
int i = 255;
foreach(string s in strings)
Console.WriteLine("{0} as {1}: {2}",
i, s, i.ToString(s,null));
}
}
}
123.12345678901234 as C: $123.12 123.12345678901234 as c: $123.12 123.12345678901234 as E: 1.231235E+002 123.12345678901234 as e: 1.231235e+002 123.12345678901234 as F: 123.12 123.12345678901234 as G: 123.123456789012 123.12345678901234 as g: 123.123456789012 123.12345678901234 as N: 123.12 123.12345678901234 ...
Read now
Unlock full access