Class1.cs
上传用户:lxycoco
上传日期:2022-07-21
资源大小:38457k
文件大小:1k
- using System;
- using System.Threading;
- using System.Globalization;
- namespace Wrox.ProCSharp.Localization
- {
- class Class1
- {
- static void Main(string[] args)
- {
- DateTime d = new DateTime(2003, 08, 09);
- // current culture
- System.Console.WriteLine(d.ToLongDateString());
- // use IFormatProvider
- Console.WriteLine(d.ToString("D", new CultureInfo("fr-FR")));
- // use culture of thread
- CultureInfo ci = Thread.CurrentThread.CurrentCulture;
- Console.WriteLine(ci.ToString() + ": " + d.ToString("D"));
- ci = new CultureInfo("es-ES");
- Thread.CurrentThread.CurrentCulture = ci;
- Console.WriteLine(ci.ToString() + ": " + d.ToString("D"));
- }
- }
- }