Convert.ToDouble(QUOT; 4089.90")输出40.899,00为什么? [英] Convert.ToDouble("4089.90") outputs 40.899,00 why?

查看:112
本文介绍了Convert.ToDouble(QUOT; 4089.90")输出40.899,00为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我开发使用数precision软件,但我有这个问题,它发生时,我有一个字符串转换为加倍输出我有不同的文化。

Hi everyone I am developing a software that uses number precision, but I have this problem, it happens that when I take a string to convert to double it outputs me with a different culture.

例如我用

Convert.ToDouble("4089.90"); // it outputs 40.899,00

在我的电脑奇怪的原因它工作正常,但在客户端PC上(与区域设置相同的培养)显示我后输出。我知道我可以使用修复

Is strange cause in my computer it works OK but on the client's PC (with the same culture in regional settings) shows me the latter output. I know I can fix it using

Convert.ToDouble("4089.90", System.Globalization.CultureInfo.InvariantCulture);

但是,使用Convert.ToDouble节目中有很多code,而我不希望改变这一切,在另一方面,我想知道为什么会这样。

But there is a lot of code in the program using "Convert.ToDouble" and I wouldn't like to change all of it, on the other hand I want to understand why this happens.

先谢谢了。

推荐答案

您可以设置文化与您的线索:

You can set the culture for your thread with:

Thread.CurrentThread.CurrentCulture = 
       System.Globalization.CultureInfo.InvariantCulture;

这篇关于Convert.ToDouble(QUOT; 4089.90")输出40.899,00为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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