难道Decimal.Parse()支持科学记数法? [英] Does Decimal.Parse() support scientific notation?

查看:214
本文介绍了难道Decimal.Parse()支持科学记数法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
   C#解析从指数符号数值

我目前有:

decimal value = Decimal.Parse(dataRow["column"].ToString());

有一个在后端也就是在科学记数法(即3.2661758893885E-05),并导致在解析出现FormatException一些数据。有没有一种简单的方法来做到这一点?

There is some data in the backend that is in scientific notation (ie 3.2661758893885E-05) and which is causing a FormatException on the parse. Is there an easy way to do this?

推荐答案

尝试是这样的:

Decimal.Parse(strExpression, System.Globalization.NumberStyles.AllowExponent));

这篇关于难道Decimal.Parse()支持科学记数法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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