设置点,而不是逗号的数值 [英] Set up dot instead of comma in numeric values

查看:154
本文介绍了设置点,而不是逗号的数值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有新的XmlDocument对象,胃内XML是我的程序中创建...

I have new XmlDocument object, i.g. xml is created during my program...

我想创建的XML所有数值是用点符号,而不是默认的逗号。

I want all numeric values in created xml was with dot symbol instead of comma by default.

我能做些什么来一次声明它,而不是解析每个十进制值?

Can I do something to declare it once, not to parse every decimal value?

即。要设置此点,而不是逗号某处开始,不用担心这个,直到结束?

I.e. To set up this dot instead of comma somewhere in the beginning and don't worry about this till the end?

推荐答案

试试这个:

System.Globalization.CultureInfo customCulture = (System.Globalization.CultureInfo)System.Threading.Thread.CurrentThread.CurrentCulture.Clone();
customCulture.NumberFormat.NumberDecimalSeparator = ".";

System.Threading.Thread.CurrentThread.CurrentCulture = customCulture;

这篇关于设置点,而不是逗号的数值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆