Reputation: 197
I am new in asp.net
and I want to know what does System.Globalization.CultureInfo enGB
do
Whole code(System.Globalization.CultureInfo enGB = new System.Globalization.CultureInfo("en-GB");
)
Upvotes: 1
Views: 2851
Reputation: 17039
As per the MSDN definition:
CultureInfo provides information about a specific culture (called a locale for unmanaged code development). The information includes the names for the culture, the writing system, the calendar used, the sort order of strings, and formatting for dates and numbers.
CultureInfo
is used when you create an application which will potentially be accessed by users from different countries. So basically if you set the culture to English - Great Britain all the monetary amounts,dates and sort ordering will be done according to the en-GB culture.
Example:
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");
Upvotes: 1