title: C# String.Format with Nested Number Formatting
body: <p>I'm trying to create a generic specification string generator that can format to any number of decimal places, i.e. "Temperature must be 20.5 C to 40.0 C", "Humidity must be 15 % to 85 %", "Gas inlet pressure must be 2.25 ATM to 2.75 ATM", etc.</p>
  
  <p>Right now, I'm doing the following which works but I feel that it can be simplified.</p>
  
  <pre><code>public static string SpecToString(double minimum, double maximum, int digits)
  {
      string numberFormatMin = "{0:f" + digits + "}";
      string numberFormatMax = "{1:f" + digits + "}";
  
      return String.Format(numberFormatMin + " to " + numberFormatMax, minimum, maximum);
  }
  </code></pre>
  
  <p>Is there anyway for String.Format to "nest" parameters like the following?  As is, it throws an exception with input string not in the correct format.</p>
  
  <pre><code>public static string SpecToString2(double minimum, double maximum, int digits)
  {
      return String.Format("{0:f{2}} to {1:f{2}}", minimum, maximum, digits);
  }
  </code></pre>