Q:

Decimal ToString including insignificant characters

If you execute the following line of Code:
((15m)*(1.0000m)).ToString()

You get the result of "15.0000"
I have a long lived object which gets serialized to a binary format, when we print the value out after re-hydrating it, we end up with the insignificant 0's.
It looks like decimals retain the information about the greatest percision used on them. Even if the precision is insignificant. How can I display only the significant digits?

A:

Try using this:
((15m)*(1.0000m).ToString(".00######");

This results in 15.00
To get 15 use a format string of ".#####" which allows a precision of 5 to still be listed.

