How do I format a decimal number so that, if there are one or two digits to the right of the decimal point, that shows up (e.g. 123.45) but, if there are digits of zero to the right of the decimal point, the number is formatted as a whole number (e.g. 123.00 shows as 123)?
I know how to specify formatting such that you always show a certain number of decimal places (e.g. ToString("N2") will show 123 as 123.00) but I'm not sure how to show no decimal places if there are zero digits to the right of the decimal point.