---
title: "小数点转换出错的问题"
author: "sky00768"
date: "2010-10-22T16:33:09Z"
tags: ["thread"]
categories: ["编程语言"]
slug: "untitled"
draft: false
lastmod: "2010-10-22T16:34:21Z"
id: 791654
url: "https://sky00768.iteye.com/blog/791654"
---

开发环境和部署环境中可能出现小数点位数倍数扩大的问题，例如在开发环境输入0.08，在本地界面上显示0.08正常，而部署到服务器上时输入0.08，可能界面会显示8，出现该情况是由于服务器环境和开发环境的区域不同引起的，解决的方法：在执行计算代码之前先强制将区域设置为中国：

 

Thread.CurrentThread.CurrentCulture = new CultureInfo("zh-CN");

在使用上面的代码中还得添加如下引用：

using System.Threading;  
using System.Globalization;