2
NumberFormatInfo nfi = new NumberFormatInfo()
{
CurrencySymbol = "$$s. ",
CurrencyGroupSeparator = ".",
CurrencyDecimalSeparator = ",",
NegativeSign = "-",
CurrencyNegativePattern = 2
};
double amount = double.Parse("$$s. 1.123,00", nfi);
最後一行拋出FormatException
,我不知道爲什麼。我想實際上解析字符串來源於此:string.Format(...,double)後跟double.Parse使用相同的NumberFormatInfo將導致FormatException。爲什麼?
String.Format(nfi, "{0:C}", 1123.00)