Is there a way (in .NET) to remove trailing zeros from a number when using .ToString("...") , but to display up to two decimal places if the number is not an integer:
- (12345.00) .ToString (...) should display as 12345
- (12345.10) .ToString (...) should display as 12345.10
- (12345.12) .ToString (...) should display as 12345.12
Is there one line of format format that will work in all of these scenarios?
.ToString("#.##") almost works, but does not show a terminating 0 for scenario 2 ...
Also, other cultures are not a problem, I just want a decimal point (not a comma, etc.)
David_001
source share