title: Using NumberFormat property in ASP.NET Core
body: <p><a href="http://www.jerriepelser.com/blog/setting-thread-culture-aspnet5" rel="nofollow noreferrer">The localization system has changed quite a bit in ASP.NET Core</a>. The <code>CurrentCulture</code> is no longer available in the current thread.</p>
  
  <p>I'm trying to set <code>NumberFormat</code> property of <code>CurrentCulture</code> as explained <a href="https://stackoverflow.com/a/2316663/5173926">here</a>, in order to customize the format for displaying money but obviously it's no longer possible that way. So how does one set the <code>NumberFormat</code> property for <code>CurrentCulture</code>?</p>
  
  <p>The code that used to work for this before asp.net core:</p>
  
  <pre><code>CurrentCulture modified = new CultureInfo(Thread.CurrentThread.CurrentCulture.Name);
  Thread.CurrentThread.CurrentCulture = modified;
  var numberFormat = modified.NumberFormat;
  numberFormat.CurrencySymbol = "RM";
  numberFormat.CurrencyDecimalDigits = 2;
  numberFormat.CurrencyDecimalSeparator = ".";
  numberFormat.CurrencyGroupSeparator = ",";
  </code></pre>
  
  <p>Then for example somewhere in my code I want to do:</p>
  
  <pre><code>string fMoney;
  fMoney = money.ToString("C");
  return fMoney;
  </code></pre>
  
  <p>and expect the <code>numberFormat</code> settings to be applied.</p>