The conversion calls dec=Decimal.Parse("5E-05", NumberStyles.AllowLeadingSign| NumberStyles.AllowDecimalPoint| NumberStyles.AllowLeadingWhite| NumberStyles.AllowTrailingWhite, NumberFormatInfo.InvariantInfo);
which calls into native code via the Number class. It specifically disallows the NumberStyles.AllowExponent bitfield because the XML Schema datatypes spec does not allow exponents for Decimal types. http://www.w3.org/TR/xmlschema-2/#decimal The spec allows up to 18 digits and no exponent. Richard > -----Original Message----- > From: dotnet discussion [mailto:[EMAIL PROTECTED]]On Behalf Of > Morten Abrahamsen > Sent: 31 May 2002 11:16 > To: [EMAIL PROTECTED] > Subject: [DOTNET] XmlConvert and Decimal bug > > > One would assume that the following would work: > > string decimalString = XmlConvert.ToString(0.00005M); > decimal dec = XmlConvert.ToDecimal(decimalString); > > However it throws a FormatException because the string conversion > results in an exponential format, which isn't permitted in the ToDecimal > parser. > > Is this a common bug, or is this related to some strange locale > settings... (it should be schema compliant and locale invariant > though..) > > Any thoughts ? > > Morty > > You can read messages from the DOTNET archive, unsubscribe from DOTNET, or > subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.