Set CultureInfo in Asp.net Core to have a . as CurrencyDecimalSeparator instead of ,

后端 未结 6 962
清酒与你
清酒与你 2020-12-01 10:32

I\'m going mad. I just want the culture used in the entire Asp.net core application to be set to \"en-US\". But nothing seems to work. Where to I set the culture for the ent

6条回答
  •  -上瘾入骨i
    2020-12-01 10:36

    This is what solves it for me:

    Setting the following in StartUp.Configure

    var cultureInfo = new CultureInfo("en-US");
    cultureInfo.NumberFormat.CurrencySymbol = "€";
    
    CultureInfo.DefaultThreadCurrentCulture = cultureInfo;
    CultureInfo.DefaultThreadCurrentUICulture = cultureInfo;
    

提交回复
热议问题