Turn: Learning classification of currentculture and currentuiculture in thread: C #110 people read comments (0) collect reports
Using system;
Using system. Collections. Generic;
Using system. text;
Using system. Collections. Specialized;
Using system. collections;
Using system. Globalization;
Using system. configuration;
Using system. diagnostics;
Using system. IO;
Using system. Threading;
Namespace E1
{
Class Program
{
Static void main (string [] ARGs)
{
Cultureinfo userculture = thread. currentthread. currentculture;
Console. writeline (userculture. Name );
Console. writeline (userculture. lcid );
Console. writeline (userculture. nativename );
Console. writeline (userculture. displayname );
Console. writeline (userculture. twoletterisolanguagename );
Console. writeline (100000). tostring ("C "));
Cultureinfo usculture = thread. currentthread. currentuiculture;
Console. writeline (usculture. Name );
Console. writeline (usculture. displayname );
Console. Readline ();
}
}
}
Msdn description
Thread. currentculture attributes
Gets or sets the culture of the current thread.
The thread. currentuiculture attribute gets or sets the current culture used by the resource manager to search for regional-specific resources at runtime.
When the code is run for the first time after the settings are changed from the control panel, the region information is not changed., ThroughThe userculture information instantiated by the currentculture attribute changes, but the usculture instantiated by the currentuiculture attribute does not.
The cultureinfo. currentuiculture attribute is set for each thread and returns the current user interface culture. This property is composed
The ResourceManager class is used to find specific regional resources at runtime. You can use a non-specific, specific, or
InvariantcultureCurrentuicultureAttribute. Available
Thread. currentthread attribute settingsCurrentculture.
The cultureinfo. currentculture attribute is set for each thread to determine the default format, text sorting order, string comparison, and case-insensitive conversion of dates, times, currencies, and numbers.CurrentcultureAttribute is not a language setting. It only contains data related to the standard settings of the geographical region. Therefore
CurrentcultureProperty is set to a specific culture or
Invariantculture. Available
Thread. currentthread attribute settingsCurrentculture.
One sentence: when the program is running, the currentuiculture attribute is used to determine the type of resources to be loaded, while the currentculture attribute is used to determine how to format currencies, numbers, and dates.
The default value of the currentculture attribute is the User Locale of the operating system, which can be set in the control panel.
The default value of the currentuiculture attribute is the operating system user interface language.
The value of the currentculture attribute must be a specific culture, such as "fr-fr". It cannot be a neutral culture,
For example, "FR". A neutral culture such as "FR" may cause problems because it applies to all French languages,
However, France, Belgium and Quebec use different currencies.