我需要幫助。
下面的代碼在安裝了3.5和4.5 .NET Framework的Win7/Win8機器上運行良好。c#Covert.ToDecimal在3.5和4.5框架和xp機器上的差異
CultureInfo info = CultureInfo.CreateSpecificCulture("hr-HR");
string ui = txtUkupanIznos.Text.Trim();
decimal pvalue;
if (decimal.TryParse(ui, NumberStyles.Any, info, out pvalue))
{
decimal poreznaStopa = 0.00m;
decimal ukupanIznos = 0.00m;
try
{
poreznaStopa = Convert.ToDecimal(txtstopa.Text.Replace(".", ","), info);
ukupanIznos = Convert.ToDecimal(ui.Replace(".", ","), info);
}
...
但隨着安裝了.NET Framework 3.5 SP1的XP的機器上,這將引發一個出現FormatException所以我需要刪除Replace(".", ",")
爲什麼?