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

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
 
N

Nicholas Paldino [.NET/C# MVP]

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

Ignacio Machin ( .NET/ C# MVP )

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top