c# - How do I format to only include decimal if there are any -


what best way format decimal if want decimal displayed if not integer.

eg:

decimal amount = 1000m decimal vat = 12.50m 

when formatted want:

amount: 1000 (not 1000.0000) vat: 12.5 (not 12.50) 

    decimal 1 = 1000m;     decimal 2 = 12.5m;      console.writeline(one.tostring("0.##"));     console.writeline(two.tostring("0.##")); 

Comments

Popular posts from this blog

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

c++ - How do I get a multi line tooltip in MFC -

unit testing - How to mock PreferenceManager in Android? -