Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

153
Visualizações
CultureInfo changes based on computer settings

I am running a .NET 5 MVC Web Application through IIS both on my local machine and a remote server.

I have noticed a strange bug where the computer's local settings appear to affect the result of the CultureInfo class

In Windows 10, if I open Settings > Time & Language > Region, and click Change data formats so that my Short time is 24 hour, i.e. 13:40 vs 1:40 PM, then the result of CultureInfo will also change. I had always assumed that changing my computer settings should not affect .NETs built in cultures, and that they should be the same no matter what computer the code runs on, so:

CultureInfo.CreateSpecificCulture("en-US");

Should return the same CultureInfo object no matter what computer the code is running on or what Date & Time settings the user decides to use.

I initially wondered if perhaps I was using the CultureInfo class wrong, so I also tried:

new CultureInfo("en-US");

But the results were the same.

Is there some way to tell the CultureInfo class to use the default values for the culture and not the use the settings that I currently have on my computer?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

var culture = new CultureInfo("en-US", false);

The second parameter of the constructor (useUserOverride) means exactly that.

  • true use the system settings
  • false use the default culture settings
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda