开发者

Does Decimal.Parse() support scientific notation? [duplicate]

开发者 https://www.devze.com 2023-03-04 12:06 出处:网络
This question already has answers here: Closed 11 years ago. 开发者_开发百科 Possible Duplicate: C# Parse a Number from Exponential Notation
This question already has answers here: Closed 11 years ago. 开发者_开发百科

Possible Duplicate:

C# Parse a Number from Exponential Notation

I currently have:

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

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?


Try something like this:

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

精彩评论

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