title: What is the c# equivalent of Java DecimalFormat?
body: <p>How would I convert the following code to C#</p>
  
  <pre><code>DecimalFormat form 
  String pattern = "";
  for (int i = 0; i &lt; nPlaces - nDec - 2; i++) {
          pattern += "#";
  }
  pattern += "0.";
  for (int i = nPlaces - nDec; i &lt; nPlaces; i++) {
          pattern += "0";
  }
  form = (DecimalFormat) NumberFormat.getInstance();
  DecimalFormatSymbols symbols = form.getDecimalFormatSymbols();
  symbols.setDecimalSeparator('.');
  form.setDecimalFormatSymbols(symbols);
  form.setMaximumIntegerDigits(nPlaces - nDec - 1);
  form.applyPattern(pattern);
  </code></pre>
  
  <p><strong>EDIT</strong> The particular problem is that I do not wish the decimal separator to change with Locale (e.g. some Locales would use ',').</p>