我是asp.net的新手,我想知道System.Globalization.CultureInfo enGB是做什么的整个代码(System.Globalization.CultureInfo enGB = new System.Globalization.CultureInfo("en-GB");)
发布于 2016-06-13 08:40:30
根据MSDN的定义:
CultureInfo提供有关特定区域性的信息(称为非托管代码开发的区域设置)。这些信息包括区域性的名称、书写系统、使用的日历、字符串的排序顺序以及日期和数字的格式。
当您创建一个可能会被来自不同国家的用户访问的应用程序时,将使用CultureInfo。因此,基本上,如果你将文化设置为英语-大不列颠,那么所有的货币金额、日期和排序都将按照en-GB文化进行。
示例:
decimal amount = 12.99M;
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-GB");
//The amount will be displayed in pounds - £12.99
string amountPounds = amount.ToString("C");
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
//The anount will be displayed in dollars - $12.99
string amountDollars = amount.ToString("C");https://stackoverflow.com/questions/37784693
复制相似问题