decimal.TryParse() drops leading “1”

后端 未结 2 851
刺人心
刺人心 2021-02-05 12:35

Short and sweet version:

On one machine out of around a hundred test machines decimal.TryParse() is converting \"1.01\" to 0.01


Okay, this is going to soun

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-05 12:58

    see how the regional settings are set for this computer it might be that "." is set as thousand separator not as decimal separator. Try using Decimal.TryParse (String, NumberStyles, IFormatProvider, out Decimal val) and pass NumberFormatInfo created with decimal separator "."

提交回复
热议问题