The
RegionInfo class provides information about geographical regions, although it does not provide the same format functionality as the CultureInfo class. To create a new instance of the RegionInfo class, you pass the two-letter name that identifies the region
to the class constructor.
The RegionInfo class provides several properties that you can use to retrieve information about a region. These properties include
Name,
DisplayName,
EnglishName, and
CurrencySymbol.
For example:using System;
using System.Globalization;
using System.Threading;
using System.Text;
namespace CurrentCultureinfomod2less1
{
class Program
{
static void Main(string[] args)
{
//1
// The following code examples instantiate a new RegionInfo class by using the two letters
//of the culture name that are supplied in the code. The code examples produce the
//following output:
//• Name: FR
//• Display name: फ्रांस
RegionInfo frRegion = new RegionInfo("FR");
Console.WriteLine("Name: {0}", frRegion.Name);
Console.WriteLine("Display name: {0}", frRegion.DisplayName);
Console.WriteLine("Symbol: {0}", frRegion.CurrencySymbol);
//2
RegionInfo myRI1 = new RegionInfo("FR");
Console.WriteLine(" Name:{0}", myRI1.Name);
Console.WriteLine(" DisplayName: {0}", myRI1.DisplayName);
Console.WriteLine(" EnglishName: {0}", myRI1.EnglishName);
Console.WriteLine(" IsMetric: {0}", myRI1.IsMetric);
Console.WriteLine(" ThreeLetterISORegionName: {0}", myRI1.ThreeLetterISORegionName);
Console.WriteLine(" ThreeLetterWindowsRegionName: {0}", myRI1.ThreeLetterWindowsRegionName);
Console.WriteLine(" TwoLetterISORegionName: {0}", myRI1.TwoLetterISORegionName);
Console.WriteLine(" CurrencySymbol: {0}", myRI1.CurrencySymbol);
Console.WriteLine(" ISOCurrencySymbol: {0}", myRI1.ISOCurrencySymbol);
Console.WriteLine();
//3
// Compares the RegionInfo above with another RegionInfo created using CultureInfo.
RegionInfo myRI1 = new RegionInfo("US");
RegionInfo myRI2 = new RegionInfo(new CultureInfo("en-US", false).LCID);
if (myRI1.Equals(myRI2))
Console.WriteLine("The two RegionInfo instances are equal.");
else
Console.WriteLine("The two RegionInfo instances are NOT equal.");
Console.ReadLine();
}
}
}
--
Posted By Amit thakur to
Microsoft Techies Blog at 5/07/2011 02:02:00 PM