我做了一个简单的应用程序,将一定数量的比特币转换为货币.
该应用程序在我的Android模拟器(Nexus 5x)上工作正常.我的问题是该应用程序抛出:
System.FormatException:输入字符串的格式不正确
当我在我的Android设备上测试它.我已经对我的模拟器和设备进行了调试,并且在参数方面没有差异.
有人有任何想法为什么会发生此异常?
public static async Task<decimal> ConvertCurrency(string curr, decimal amount)
{
var currency = await GetCurrency(curr);
var stringRate = currency.Rate;
var rate = decimal.Parse(stringRate);//this is where the it crash
var result = rate * amount;
return result;
}
Run Code Online (Sandbox Code Playgroud)