Double.TryParse() input decimal separator different than system decimal separator

前端 未结 4 1252
眼角桃花
眼角桃花 2021-01-04 14:42

I have a source XML that uses a dot (\".\") as a decimal separator and I am parsing this on a system that uses a comma (\",\") as a decimal separator.

As a result,

4条回答
  •  清歌不尽
    2021-01-04 15:31

    XML standard is explicit about the formatting of dates and numbers etc. This helps to ensure that the XML is platform independent and interoperable. Take a look at using XmlConvert for xml data.

    double value = XmlConvert.ToDouble(stringValue);
    

提交回复
热议问题