title: Formatting double as string in C#
body: <p>I have a Double which could have a value from around 0.000001 to 1,000,000,000.000</p>
  
  <p>I wish to format this number as a string but conditionally depending on its size. So if it's very small I want to format it with something like:</p>
  
  <pre><code>String.Format("{0:.000000000}", number);
  </code></pre>
  
  <p>if it's not that small, say 0.001 then I want to use something like</p>
  
  <pre><code>String.Format("{0:.00000}", number);
  </code></pre>
  
  <p>and if it's over, say 1,000 then format it as:</p>
  
  <pre><code>String.Format("{0:.0}", number);
  </code></pre>
  
  <p>Is there a clever way to construct this format string based on the size of the value I'm going to format?</p>