Learning about currentculture and currentuiculture in thread

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.