I have a numerical value in a string: 12.50000
When i want to convert that string to decimal using Convert.ToDecimal() it deletes the period and it becomes 1250000 .
Is there a way to stop this? Because the final value is supposed to be 12.5, not 1250000.
private void Test()
{
var str = "12.50000";
var y = decimal.TryParse(str, out var x);
Debug.WriteLine(x);
}
why not using decimal.TryParse?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.