开发者

Floating point numbers in XML

开发者 https://www.devze.com 2022-12-31 20:14 出处:网络
what is the best way to handle floating point numbers in XML? If I have, for instance: double a = 123.456;

what is the best way to handle floating point numbers in XML? If I have, for instance:

double a = 123.456;

and I would like to keep it as

<A> 123.456 </A>
开发者_如何学Go

simply using ...

myDoc.createTextNode(a.ToString());

is fine? Or should it be done with some Globalization stuff to make it region-independent?


Have a look at the XmlConvert class, specifically the XmlConvert.ToString Method (Double).

[The XmlConvert Class] provides methods for converting between common language runtime types and XML Schema definition language (XSD) types. When converting data types the values returned are locale independent.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号