title: How to format a decimal without trailing zeros
body: <p>I've just learned that a decimal somehow remembers how much trailaing zero's were needed to store a number. With other words: it remembers the size of the fraction.</p>
  
  <p>For example: </p>
  
  <pre><code>123M.ToString() ==&gt; resuls in: 123
  123.00M.ToString() ==&gt; resuls in: 123.00
  123.450M.ToString() ==&gt; resuls in: 123.450
  </code></pre>
  
  <p>I am looking for a formatting string or another trick to get rid of those "unneeded" trailing zeros, but keeping the significant digits. So:</p>
  
  <pre><code>123M.ToString() ==&gt; resuls in: 123
  123.00M.ToString() ==&gt; resuls in: 123
  123.450M.ToString() ==&gt; resuls in: 123.45
  </code></pre>
  
  <p>Removing the zeros at the end of the new string is not a real option for me, because then I have to find out if the string contains a fraction and if so, also have to remove the optional '.' or ',' depending on the culture, etc.</p>