Jimbo Jimbo - 1 year ago 99
C# Question

Parse a Number from Exponential Notation

I need to parse the string "1.2345E-02" (a number expressed in exponential notation) to a decimal data type, but

simply throws an error

Answer Source

It is a floating point number, you have to tell it that:

decimal d = Decimal.Parse("1.2345E-02", System.Globalization.NumberStyles.Float);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download