Home > Mobile >  Seting culture info from the project properties
Seting culture info from the project properties

Time:02-14

I am creating winforms app in Visual Studio 2019 in C# (.NET) and I have this code:

   CultureInfo ci = new CultureInfo("de");
   Thread.CurrentThread.CurrentCulture = ci;

to set the culture info. However, I wonder if I can set culture info some other way manually like project -> properties but I cannot find it at the moment.

Is this possible?

CodePudding user response:

Try something like this:

<configuration>
  [...]
  <appSettings>
    [...]
    <add key="defaultCulture" value="de" />
    [...]
  </appSettings>
  [...]
</configuration>

and recover the value like this:

var value = System.Configuration.ConfigurationManager.AppSettings["defaultCulture"];
  • Related