本文整理汇总了C#中System.Globalization.CultureInfo类的典型用法代码示例。如果您正苦于以下问题:C# CultureInfo类的具体用法?C# CultureInfo怎么用?C# CultureInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CultureInfo类属于System.Globalization命名空间,在下文中一共展示了CultureInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
//引入命名空间
using System;
using System.Collections;
using System.Globalization;
public class SamplesCultureInfo
{
public static void Main()
{
// Creates and initializes the CultureInfo which uses the international sort.
CultureInfo myCIintl = new CultureInfo("es-ES", false);
// Creates and initializes the CultureInfo which uses the traditional sort.
CultureInfo myCItrad = new CultureInfo(0x040A, false);
// Displays the properties of each culture.
Console.WriteLine("{0,-31}{1,-47}{2,-25}", "PROPERTY", "INTERNATIONAL", "TRADITIONAL");
Console.WriteLine("{0,-31}{1,-47}{2,-25}", "CompareInfo", myCIintl.CompareInfo, myCItrad.CompareInfo);
Console.WriteLine("{0,-31}{1,-47}{2,-25}", "DisplayName", myCIintl.DisplayName, myCItrad.DisplayName);
Console.WriteLine("{0,-31}{1,-47}{2,-25}", "EnglishName", myCIintl.EnglishName, myCItrad.EnglishName);
Console.WriteLine("{0,-31}{1,-47}{2,-25}", "IsNeutralCulture", myCIintl.IsNeutralCulture, myCItrad.IsNeutralCulture);
Console.WriteLine("{0,-31}{1,-47}{2,-25}", "IsReadOnly", myCIintl.IsReadOnly, myCItrad.IsReadOnly);
Console.WriteLine("{0,-31}{1,-47}{2,-25}", "LCID", myCIintl.LCID, myCItrad.LCID);
Console.WriteLine("{0,-31}{1,-47}{2,-25}", "Name", myCIintl.Name, myCItrad.Name);
Console.WriteLine("{0,-31}{1,-47}{2,-25}", "NativeName", myCIintl.NativeName, myCItrad.NativeName);
Console.WriteLine("{0,-31}{1,-47}{2,-25}", "Parent", myCIintl.Parent, myCItrad.Parent);
Console.WriteLine("{0,-31}{1,-47}{2,-25}", "TextInfo", myCIintl.TextInfo, myCItrad.TextInfo);
Console.WriteLine("{0,-31}{1,-47}{2,-25}", "ThreeLetterISOLanguageName", myCIintl.ThreeLetterISOLanguageName, myCItrad.ThreeLetterISOLanguageName);
Console.WriteLine("{0,-31}{1,-47}{2,-25}", "ThreeLetterWindowsLanguageName", myCIintl.ThreeLetterWindowsLanguageName, myCItrad.ThreeLetterWindowsLanguageName);
Console.WriteLine("{0,-31}{1,-47}{2,-25}", "TwoLetterISOLanguageName", myCIintl.TwoLetterISOLanguageName, myCItrad.TwoLetterISOLanguageName);
Console.WriteLine();
// Compare two strings using myCIintl.
Console.WriteLine("Comparing \"llegar\" and \"lugar\"");
Console.WriteLine(" With myCIintl.CompareInfo.Compare: {0}", myCIintl.CompareInfo.Compare("llegar", "lugar"));
Console.WriteLine(" With myCItrad.CompareInfo.Compare: {0}", myCItrad.CompareInfo.Compare("llegar", "lugar"));
}
}
输出:
PROPERTY INTERNATIONAL TRADITIONAL CompareInfo CompareInfo - es-ES CompareInfo - es-ES_tradnl DisplayName Spanish (Spain) Spanish (Spain) EnglishName Spanish (Spain, International Sort) Spanish (Spain, Traditional Sort) IsNeutralCulture False False IsReadOnly False False LCID 3082 1034 Name es-ES es-ES NativeName Español (España, alfabetización internacional) Español (España, alfabetización tradicional) Parent es es TextInfo TextInfo - es-ES TextInfo - es-ES_tradnl ThreeLetterISOLanguageName spa spa ThreeLetterWindowsLanguageName ESN ESP TwoLetterISOLanguageName es es Comparing "llegar" and "lugar" With myCIintl.CompareInfo.Compare: -1 With myCItrad.CompareInfo.Compare: 1
示例2: Main
//引入命名空间
using System;
using System.Globalization;
using System.Threading;
public class Example
{
public static void Main()
{
CultureInfo culture1 = CultureInfo.CurrentCulture;
CultureInfo culture2 = Thread.CurrentThread.CurrentCulture;
Console.WriteLine("The current culture is {0}", culture1.Name);
Console.WriteLine("The two CultureInfo objects are equal: {0}",
culture1 == culture2);
}
}
输出:
The current culture is en-US The two CultureInfo objects are equal: True
示例3: Main
//引入命名空间
using System;
using System.Globalization;
using System.Threading;
public class Example
{
public static void Main()
{
CultureInfo uiCulture1 = CultureInfo.CurrentUICulture;
CultureInfo uiCulture2 = Thread.CurrentThread.CurrentUICulture;
Console.WriteLine("The current UI culture is {0}", uiCulture1.Name);
Console.WriteLine("The two CultureInfo objects are equal: {0}",
uiCulture1 == uiCulture2);
}
}
输出:
The current UI culture is en-US The two CultureInfo objects are equal: True
示例4: Main
//引入命名空间
using System;
using System.Globalization;
public class Example
{
public static void Main()
{
CultureInfo current = CultureInfo.CurrentCulture;
Console.WriteLine("The current culture is {0}", current.Name);
CultureInfo newCulture;
if (current.Name.Equals("fr-FR"))
newCulture = new CultureInfo("fr-LU");
else
newCulture = new CultureInfo("fr-FR");
CultureInfo.CurrentCulture = newCulture;
Console.WriteLine("The current culture is now {0}",
CultureInfo.CurrentCulture.Name);
}
}
输出:
The current culture is en-US The current culture is now fr-FR
示例5: Main
//引入命名空间
using System;
using System.Globalization;
public class Example
{
public static void Main()
{
CultureInfo current = CultureInfo.CurrentUICulture;
Console.WriteLine("The current UI culture is {0}", current.Name);
CultureInfo newUICulture;
if (current.Name.Equals("sl-SI"))
newUICulture = new CultureInfo("hr-HR");
else
newUICulture = new CultureInfo("sl-SI");
CultureInfo.CurrentUICulture = newUICulture;
Console.WriteLine("The current UI culture is now {0}",
CultureInfo.CurrentUICulture.Name);
}
}
输出:
The current UI culture is en-US The current UI culture is now sl-SI
示例6: Main
//引入命名空间
using System;
using System.Globalization;
public class Example
{
public static void Main()
{
// Get all custom cultures.
CultureInfo[] custom = CultureInfo.GetCultures(CultureTypes.UserCustomCulture);
if (custom.Length == 0) {
Console.WriteLine("There are no user-defined custom cultures.");
}
else {
Console.WriteLine("Custom cultures:");
foreach (var culture in custom)
Console.WriteLine(" {0} -- {1}", culture.Name, culture.DisplayName);
}
Console.WriteLine();
// Get all replacement cultures.
CultureInfo[] replacements = CultureInfo.GetCultures(CultureTypes.ReplacementCultures);
if (replacements.Length == 0) {
Console.WriteLine("There are no replacement cultures.");
}
else {
Console.WriteLine("Replacement cultures:");
foreach (var culture in replacements)
Console.WriteLine(" {0} -- {1}", culture.Name, culture.DisplayName);
}
Console.WriteLine();
}
}
输出:
Custom cultures: x-en-US-sample -- English (United States) fj-FJ -- Boumaa Fijian (Viti) There are no replacement cultures.
示例7: Random
//引入命名空间
using System;
using System.Globalization;
using System.Threading;
public class Example
{
static Random rnd = new Random();
public static void Main()
{
if (Thread.CurrentThread.CurrentCulture.Name != "fr-FR") {
// If current culture is not fr-FR, set culture to fr-FR.
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("fr-FR");
Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture("fr-FR");
}
else {
// Set culture to en-US.
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US");
Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture("en-US");
}
ThreadProc();
Thread worker = new Thread(ThreadProc);
worker.Name = "WorkerThread";
worker.Start();
}
private static void DisplayThreadInfo()
{
Console.WriteLine("\nCurrent Thread Name: '{0}'",
Thread.CurrentThread.Name);
Console.WriteLine("Current Thread Culture/UI Culture: {0}/{1}",
Thread.CurrentThread.CurrentCulture.Name,
Thread.CurrentThread.CurrentUICulture.Name);
}
private static void DisplayValues()
{
// Create new thread and display three random numbers.
Console.WriteLine("Some currency values:");
for (int ctr = 0; ctr <= 3; ctr++)
Console.WriteLine(" {0:C2}", rnd.NextDouble() * 10);
}
private static void ThreadProc()
{
DisplayThreadInfo();
DisplayValues();
}
}
输出:
Current Thread Name: '' Current Thread Culture/UI Culture: fr-FR/fr-FR Some currency values: 8,11 € 1,48 € 8,99 € 9,04 € Current Thread Name: 'WorkerThread' Current Thread Culture/UI Culture: en-US/en-US Some currency values: $6.72 $6.35 $2.90 $7.72
示例8: Random
//引入命名空间
using System;
using System.Globalization;
using System.Threading;
public class Example
{
static Random rnd = new Random();
public static void Main()
{
if (Thread.CurrentThread.CurrentCulture.Name != "fr-FR") {
// If current culture is not fr-FR, set culture to fr-FR.
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("fr-FR");
Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture("fr-FR");
}
else {
// Set culture to en-US.
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US");
Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture("en-US");
}
DisplayThreadInfo();
DisplayValues();
Thread worker = new Thread(Example.ThreadProc);
worker.Name = "WorkerThread";
worker.Start(Thread.CurrentThread.CurrentCulture);
}
private static void DisplayThreadInfo()
{
Console.WriteLine("\nCurrent Thread Name: '{0}'",
Thread.CurrentThread.Name);
Console.WriteLine("Current Thread Culture/UI Culture: {0}/{1}",
Thread.CurrentThread.CurrentCulture.Name,
Thread.CurrentThread.CurrentUICulture.Name);
}
private static void DisplayValues()
{
// Create new thread and display three random numbers.
Console.WriteLine("Some currency values:");
for (int ctr = 0; ctr <= 3; ctr++)
Console.WriteLine(" {0:C2}", rnd.NextDouble() * 10);
}
private static void ThreadProc(Object obj)
{
Thread.CurrentThread.CurrentCulture = (CultureInfo) obj;
Thread.CurrentThread.CurrentUICulture = (CultureInfo) obj;
DisplayThreadInfo();
DisplayValues();
}
}
输出:
Current Thread Name: '' Current Thread Culture/UI Culture: fr-FR/fr-FR Some currency values: 6,83 € 3,47 € 6,07 € 1,70 € Current Thread Name: 'WorkerThread' Current Thread Culture/UI Culture: fr-FR/fr-FR Some currency values: 9,54 € 9,50 € 0,58 € 6,91 €
示例9: Random
//引入命名空间
using System;
using System.Globalization;
using System.Threading;
public class Example
{
static Random rnd = new Random();
public static void Main()
{
if (Thread.CurrentThread.CurrentCulture.Name != "fr-FR") {
// If current culture is not fr-FR, set culture to fr-FR.
CultureInfo.DefaultThreadCurrentCulture = CultureInfo.CreateSpecificCulture("fr-FR");
CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.CreateSpecificCulture("fr-FR");
}
else {
// Set culture to en-US.
CultureInfo.DefaultThreadCurrentCulture = CultureInfo.CreateSpecificCulture("en-US");
CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.CreateSpecificCulture("en-US");
}
ThreadProc();
Thread worker = new Thread(Example.ThreadProc);
worker.Name = "WorkerThread";
worker.Start();
}
private static void DisplayThreadInfo()
{
Console.WriteLine("\nCurrent Thread Name: '{0}'",
Thread.CurrentThread.Name);
Console.WriteLine("Current Thread Culture/UI Culture: {0}/{1}",
Thread.CurrentThread.CurrentCulture.Name,
Thread.CurrentThread.CurrentUICulture.Name);
}
private static void DisplayValues()
{
// Create new thread and display three random numbers.
Console.WriteLine("Some currency values:");
for (int ctr = 0; ctr <= 3; ctr++)
Console.WriteLine(" {0:C2}", rnd.NextDouble() * 10);
}
private static void ThreadProc()
{
DisplayThreadInfo();
DisplayValues();
}
}
输出:
Current Thread Name: '' Current Thread Culture/UI Culture: fr-FR/fr-FR Some currency values: 6,83 € 3,47 € 6,07 € 1,70 € Current Thread Name: 'WorkerThread' Current Thread Culture/UI Culture: fr-FR/fr-FR Some currency values: 9,54 € 9,50 € 0,58 € 6,91 €
示例10: Main
//引入命名空间
using System;
using System.Globalization;
using System.Reflection;
using System.Threading;
public class Example
{
public static void Main()
{
// Set the default culture and display the current date in the current application domain.
Info info1 = new Info();
SetAppDomainCultures("fr-FR");
// Create a second application domain.
AppDomainSetup setup = new AppDomainSetup();
setup.AppDomainInitializer = SetAppDomainCultures;
setup.AppDomainInitializerArguments = new string[] { "ru-RU" };
AppDomain domain = AppDomain.CreateDomain("Domain2", null, setup);
// Create an Info object in the new application domain.
Info info2 = (Info) domain.CreateInstanceAndUnwrap(typeof(Example).Assembly.FullName,
"Info");
// Execute methods in the two application domains.
info2.DisplayDate();
info2.DisplayCultures();
info1.DisplayDate();
info1.DisplayCultures();
}
public static void SetAppDomainCultures(string[] names)
{
SetAppDomainCultures(names[0]);
}
public static void SetAppDomainCultures(string name)
{
try {
CultureInfo.DefaultThreadCurrentCulture = CultureInfo.CreateSpecificCulture(name);
CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.CreateSpecificCulture(name);
}
// If an exception occurs, we'll just fall back to the system default.
catch (CultureNotFoundException) {
return;
}
catch (ArgumentException) {
return;
}
}
}
public class Info : MarshalByRefObject
{
public void DisplayDate()
{
Console.WriteLine("Today is {0:D}", DateTime.Now);
}
public void DisplayCultures()
{
Console.WriteLine("Application domain is {0}", AppDomain.CurrentDomain.Id);
Console.WriteLine("Default Culture: {0}", CultureInfo.DefaultThreadCurrentCulture);
Console.WriteLine("Default UI Culture: {0}", CultureInfo.DefaultThreadCurrentUICulture);
}
}
输出:
Today is 14 октября 2011 г. Application domain is 2 Default Culture: ru-RU Default UI Culture: ru-RU Today is vendredi 14 octobre 2011 Application domain is 1 Default Culture: fr-FR Default UI Culture: fr-FR
示例11: Main
//引入命名空间
using System;
using System.Globalization;
using System.Runtime.Versioning;
using System.Threading;
using System.Threading.Tasks;
[assembly:TargetFramework(".NETFramework,Version=v4.6")]
public class Example
{
public static void Main()
{
decimal[] values = { 163025412.32m, 18905365.59m };
string formatString = "C2";
Func<String> formatDelegate = () => { string output = String.Format("Formatting using the {0} culture on thread {1}.\n",
CultureInfo.CurrentCulture.Name,
Thread.CurrentThread.ManagedThreadId);
foreach (var value in values)
output += String.Format("{0} ", value.ToString(formatString));
output += Environment.NewLine;
return output;
};
Console.WriteLine("The example is running on thread {0}",
Thread.CurrentThread.ManagedThreadId);
// Make the current culture different from the system culture.
Console.WriteLine("The current culture is {0}",
CultureInfo.CurrentCulture.Name);
if (CultureInfo.CurrentCulture.Name == "fr-FR")
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
else
Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-FR");
Console.WriteLine("Changed the current culture to {0}.\n",
CultureInfo.CurrentCulture.Name);
// Execute the delegate synchronously.
Console.WriteLine("Executing the delegate synchronously:");
Console.WriteLine(formatDelegate());
// Call an async delegate to format the values using one format string.
Console.WriteLine("Executing a task asynchronously:");
var t1 = Task.Run(formatDelegate);
Console.WriteLine(t1.Result);
Console.WriteLine("Executing a task synchronously:");
var t2 = new Task<String>(formatDelegate);
t2.RunSynchronously();
Console.WriteLine(t2.Result);
}
}
输出:
The example is running on thread 1 The current culture is en-US Changed the current culture to fr-FR. Executing the delegate synchronously: Formatting using the fr-FR culture on thread 1. 163 025 412,32 € 18 905 365,59 € Executing a task asynchronously: Formatting using the fr-FR culture on thread 3. 163 025 412,32 € 18 905 365,59 € Executing a task synchronously: Formatting using the fr-FR culture on thread 1. 163 025 412,32 € 18 905 365,59 €
示例12: Main
//引入命名空间
using System;
using System.Globalization;
using System.Runtime.Versioning;
using System.Threading;
using System.Threading.Tasks;
public class Example
{
public static void Main()
{
decimal[] values = { 163025412.32m, 18905365.59m };
string formatString = "C2";
Func<String> formatDelegate = () => { string output = String.Format("Formatting using the {0} culture on thread {1}.\n",
CultureInfo.CurrentCulture.Name,
Thread.CurrentThread.ManagedThreadId);
foreach (var value in values)
output += String.Format("{0} ", value.ToString(formatString));
output += Environment.NewLine;
return output;
};
Console.WriteLine("The example is running on thread {0}",
Thread.CurrentThread.ManagedThreadId);
// Make the current culture different from the system culture.
Console.WriteLine("The current culture is {0}",
CultureInfo.CurrentCulture.Name);
if (CultureInfo.CurrentCulture.Name == "fr-FR")
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
else
Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-FR");
Console.WriteLine("Changed the current culture to {0}.\n",
CultureInfo.CurrentCulture.Name);
// Execute the delegate synchronously.
Console.WriteLine("Executing the delegate synchronously:");
Console.WriteLine(formatDelegate());
// Call an async delegate to format the values using one format string.
Console.WriteLine("Executing a task asynchronously:");
var t1 = Task.Run(formatDelegate);
Console.WriteLine(t1.Result);
Console.WriteLine("Executing a task synchronously:");
var t2 = new Task<String>(formatDelegate);
t2.RunSynchronously();
Console.WriteLine(t2.Result);
}
}
输出:
The example is running on thread 1 The current culture is en-US Changed the current culture to fr-FR. Executing the delegate synchronously: Formatting using the fr-FR culture on thread 1. 163 025 412,32 € 18 905 365,59 € Executing a task asynchronously: Formatting using the en-US culture on thread 3. $163,025,412.32 $18,905,365.59 Executing a task synchronously: Formatting using the fr-FR culture on thread 1. 163 025 412,32 € 18 905 365,59 €
示例13: Main
//引入命名空间
using System;
using System.Globalization;
using System.Runtime.Versioning;
using System.Threading;
using System.Threading.Tasks;
public class Example
{
public static void Main()
{
decimal[] values = { 163025412.32m, 18905365.59m };
string formatString = "C2";
Func<String> formatDelegate = () => { string output = String.Format("Formatting using the {0} culture on thread {1}.\n",
CultureInfo.CurrentCulture.Name,
Thread.CurrentThread.ManagedThreadId);
foreach (var value in values)
output += String.Format("{0} ", value.ToString(formatString));
output += Environment.NewLine;
return output;
};
Console.WriteLine("The example is running on thread {0}",
Thread.CurrentThread.ManagedThreadId);
// Make the current culture different from the system culture.
Console.WriteLine("The current culture is {0}",
CultureInfo.CurrentCulture.Name);
if (CultureInfo.CurrentCulture.Name == "fr-FR")
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
else
Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-FR");
Console.WriteLine("Changed the current culture to {0}.\n",
CultureInfo.CurrentCulture.Name);
CultureInfo.DefaultThreadCurrentCulture = CultureInfo.CurrentCulture;
// Execute the delegate synchronously.
Console.WriteLine("Executing the delegate synchronously:");
Console.WriteLine(formatDelegate());
// Call an async delegate to format the values using one format string.
Console.WriteLine("Executing a task asynchronously:");
var t1 = Task.Run(formatDelegate);
Console.WriteLine(t1.Result);
Console.WriteLine("Executing a task synchronously:");
var t2 = new Task<String>(formatDelegate);
t2.RunSynchronously();
Console.WriteLine(t2.Result);
}
}
输出:
The example is running on thread 1 The current culture is en-US Changed the current culture to fr-FR. Executing the delegate synchronously: Formatting using the fr-FR culture on thread 1. 163 025 412,32 € 18 905 365,59 € Executing a task asynchronously: Formatting using the fr-FR culture on thread 3. 163 025 412,32 € 18 905 365,59 € Executing a task synchronously: Formatting using the fr-FR culture on thread 1. 163 025 412,32 € 18 905 365,59 €
示例14: Main
//引入命名空间
using System;
using System.Globalization;
using System.Runtime.Versioning;
using System.Threading;
using System.Threading.Tasks;
[assembly:TargetFramework(".NETFramework,Version=v4.6")]
public class Example
{
public static void Main()
{
string formatString = "C2";
Console.WriteLine("The example is running on thread {0}",
Thread.CurrentThread.ManagedThreadId);
// Make the current culture different from the system culture.
Console.WriteLine("The current culture is {0}",
CultureInfo.CurrentCulture.Name);
if (CultureInfo.CurrentCulture.Name == "fr-FR")
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
else
Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-FR");
Console.WriteLine("Changed the current culture to {0}.\n",
CultureInfo.CurrentCulture.Name);
// Call an async delegate to format the values using one format string.
Console.WriteLine("Executing a task asynchronously in the main appdomain:");
var t1 = Task.Run(() => { DataRetriever d = new DataRetriever();
return d.GetFormattedNumber(formatString);
});
Console.WriteLine(t1.Result);
Console.WriteLine();
Console.WriteLine("Executing a task synchronously in two appdomains:");
var t2 = Task.Run(() => { Console.WriteLine("Thread {0} is running in app domain '{1}'",
Thread.CurrentThread.ManagedThreadId,
AppDomain.CurrentDomain.FriendlyName);
AppDomain domain = AppDomain.CreateDomain("Domain2");
DataRetriever d = (DataRetriever) domain.CreateInstanceAndUnwrap(typeof(Example).Assembly.FullName,
"DataRetriever");
return d.GetFormattedNumber(formatString);
});
Console.WriteLine(t2.Result);
}
}
public class DataRetriever : MarshalByRefObject
{
public string GetFormattedNumber(String format)
{
Thread thread = Thread.CurrentThread;
Console.WriteLine("Current culture is {0}", thread.CurrentCulture);
Console.WriteLine("Thread {0} is running in app domain '{1}'",
thread.ManagedThreadId,
AppDomain.CurrentDomain.FriendlyName);
Random rnd = new Random();
Double value = rnd.NextDouble() * 1000;
return value.ToString(format);
}
}
输出:
The example is running on thread 1 The current culture is en-US Changed the current culture to fr-FR. Executing a task asynchronously in a single appdomain: Current culture is fr-FR Thread 3 is running in app domain 'AsyncCulture4.exe' 93,48 € Executing a task synchronously in two appdomains: Thread 4 is running in app domain 'AsyncCulture4.exe' Current culture is fr-FR Thread 4 is running in app domain 'Domain2' 288,66 €
示例15: new CultureInfo(String cult)
//引入命名空间
using System;
using System.Globalization;
using System.Threading;
class MainClass
{
public static void Main()
{
CultureInfo ci = new CultureInfo("en-US");
}
}