calling .ToString() on Decimal values SOMETIMES appends a zero to end of string

  • Thread starter Thread starter TS
  • Start date Start date
T

TS

I have a decimal value stored in 2 separate properties and both are decimal.
in one the .toString() doesnt add an extra zero, in the other it does. They
are both exact same data type, so i cant figure it out, and both using
simple .ToString()

what is problem ( have seen other posts on internet with this problem)

thanks
 
What are the numbers you are using? Take a look at the section of the
MSDN documentation titled "Standard Numeric Format Strings", located at:

http://msdn.microsoft.com/en-us/library/dwhawy9k.aspx

Specifically, look at the "G" format, as this is what the ToString
overload with no parameters is going to use. If you have need for a
specific format, then pass it to ToString.
 
I have a decimal value stored in 2 separate properties and both are decimal.
in one the .toString() doesnt add an extra zero, in the other it does. They
are both exact same data type, so i cant figure it out, and both using
simple .ToString()

what is problem ( have seen other posts on internet with this problem)

thanks

Hi,

Can you post a short sample with the problem? your class (with only
those two properties) and the ToString() version you are using.
 
Back
Top