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.
Dim C As CultureInfo = 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())
VB
RegionInfo contains information for a given region including DisplayName, currency
information, and official abbreviations. RegionInfo also contains a static property
to retrieve the CurrentRegion.
Dim R As RegionInfo = 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}", R.IsMetric)
VB
Example
VB CultureRegion.exe
[This sample can be found at H:\Home\WU_000036_efe47225c86ca62f325a01d8519bc002\Webs\aspnet.sk\quickstarts\QuickStartv20\howto\samples\Globalization\CultureRegion\
To build this sample, open the SDK command prompt and navigate to the above path. Build the sample using the build tool msbuild
passing the solution file as the first parameter: msbuild mySample.sln. The compiled executable will be found in the sub directory \bin
directory.]
Microsoft .NET Framework SDK QuickStart Tutorials Version 2.0
Copyright � 2005 Microsoft Corporation. All rights reserved.
|