c# Round-trip 格式化
class DemoClass
{
static void Main(string[] args)
{
const double number = 1.618033988749895;
double result;
string text;
text = string.Format("{0}",number);
result = double.Parse(text);
Console.WriteLine(" {0}: result != number", result != number);
text = string.Format("{0:R}", number);
result = double.Parse(text);
Console.WriteLine("{0}: result == number", result == number);
Console.ReadKey();
}
}
摘自《c#本质论》27页