[c#] how to set default culture info for entire c# application

I want to set default culture info for that class or for entire application.

For example in Turkey 3,2 = in english 3.2

so application uses my local but i want it to use as default

System.Globalization.CultureInfo.InvariantCulture

How can i set it to that as default for that specific class or for entire application

This question is related to c# c#-4.0 globalization cultureinfo invariantculture

The answer is


With 4.0, you will need to manage this yourself by setting the culture for each thread as Alexei describes. But with 4.5, you can define a culture for the appdomain and that is the preferred way to handle this. The relevant apis are CultureInfo.DefaultThreadCurrentCulture and CultureInfo.DefaultThreadCurrentUICulture.


If you use a Language Resource file to set the labels in your application you need to set the its value:

CultureInfo customCulture = new CultureInfo("en-US");
Languages.Culture = customCulture;

Examples related to c#

How can I convert this one line of ActionScript to C#? Microsoft Advertising SDK doesn't deliverer ads How to use a global array in C#? How to correctly write async method? C# - insert values from file into two arrays Uploading into folder in FTP? Are these methods thread safe? dotnet ef not found in .NET Core 3 HTTP Error 500.30 - ANCM In-Process Start Failure Best way to "push" into C# array

Examples related to c#-4.0

Xml Parsing in C# EPPlus - Read Excel Table How to add and get Header values in WebApi How to make all controls resize accordingly proportionally when window is maximized? How to use jquery or ajax to update razor partial view in c#/asp.net for a MVC project How to get first record in each group using Linq How to get first object out from List<Object> using Linq ASP.Net MVC - Read File from HttpPostedFileBase without save .NET NewtonSoft JSON deserialize map to a different property name Datetime in C# add days

Examples related to globalization

Best practice for localization and globalization of strings and labels how to set default culture info for entire c# application String format currency How do I set the default locale in the JVM? Currency format for display Get current language in CultureInfo How to convert string to double with proper cultureinfo Regular expression for validating names and surnames? How can I detect the encoding/codepage of a text file

Examples related to cultureinfo

DateTime and CultureInfo Find number of decimal places in decimal value regardless of culture how to set default culture info for entire c# application DateTime.TryParseExact() rejecting valid formats Get current language in CultureInfo Why can't DateTime.ParseExact() parse "9/1/2009" using "M/d/yyyy" How to use localization in C# Is there a way of setting culture for a whole application? All current threads and new threads?

Examples related to invariantculture

how to set default culture info for entire c# application