Home   |   QuickStart Welcome   |   ASP.NET   |   Web Services   |   How Do I...?   
  |   I want my samples in...      

How Do I...? Common Tasks QuickStart Tutorial

How Do I...Use the CultureInfo and RegionInfo classes?



The CultureInfo and RegionInfo classes are exported from the System.Globalization namespace. CultureInfo contains a culture's DisplayName, Calendar, and various official abbreviations.

		
CultureInfo c = new CultureInfo("en-us");
Console.WriteLine ("The CultureInfo is set to: {0}", c.DisplayName);
Console.WriteLine ("The parent culture is: {0}", c.Parent.DisplayName);
Console.WriteLine ("The three letter ISO language name is: {0}", c.ThreeLetterISOLanguageName);
Console.WriteLine ("The default calendar for this culture is: {0}\n\n", c.Calendar.ToString());
C#


RegionInfo contains information for a given region including DisplayName, currency information, and official abbreviations. RegionInfo also contains a static property to retreive the CurrentRegion.

		
RegionInfo r = new RegionInfo("us");
Console.WriteLine ("The name of this region is: {0}", r.Name);
Console.WriteLine ("The currency symbol for the region is: {0}", r.CurrencySymbol);
Console.WriteLine ("Is this region metric : {0} \n\n", r.IsMetric);
C#

Example

VB CultureRegion.exe
View Source
[This sample can be found at C:\DevFusion.Data\legacy\quickstart.developerfusion.co.uk\QuickStart\howto\samples\Globalization\CultureRegion\]



Microsoft .NET Framework SDK QuickStart Tutorials Version 2.0
Copyright � 2004 Microsoft Corporation. All rights reserved.