title: How do I format a C# decimal to remove extra following 0's?
body: <p>I want to format a string as a decimal, but the decimal contains some following zeros after the decimal.  How do I format it such that those meaningless 0's disappear?</p>
  
  <pre><code>string.Format("{0}", 1100M);
  string.Format("{0}", 1100.1M);
  string.Format("{0}", 1100.100M);
  string.Format("{0}", 1100.1000M);
  </code></pre>
  
  <p>displays:</p>
  
  <pre><code>1100
  1100.1
  1100.100
  1100.1000
  </code></pre>
  
  <p>but I want it to be:</p>
  
  <pre><code>1100
  1100.1
  1100.1
  1100.1
  </code></pre>
  
  <p>For reference, here are other questions that are essentially duplicates of this, that I've found thanks to answers given here:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/4298719/parse-decimal-and-filter-extra-0-on-the-right">Parse decimal and filter extra 0 on the right?</a></li>
  <li><a href="https://stackoverflow.com/questions/3104615/best-way-to-display-decimal-without-trailing-zeros-in-c">Best way to display decimal without trailing zeroes</a></li>
  <li><a href="https://stackoverflow.com/questions/2123151/how-to-can-i-strip-zeros-and-decimal-points-off-of-decimal-strings">How can I strip zeros and decimal points off of decimal strings?</a></li>
  </ul>