RegionInfo.Name プロパティ
アセンブリ: mscorlib (mscorlib.dll 内)
構文
System.Globalization.RegionInfo(String) コンストラクタの name パラメータで指定された値。戻り値は大文字です。 または System.Globalization.RegionInfo(Int32) コンストラクタの culture パラメータで指定された、ISO 3166 で定義された国/地域の 2 文字コード。戻り値は大文字です。
現在の RegionInfo オブジェクトが、カルチャ識別子パラメータを受け入れる System.Globalization.RegionInfo(Int32) コンストラクタを使用して作成された場合、Name プロパティ値は、ISO 3166 で国/地域に対して定義された 2 文字コードのいずれかになり、大文字で表示されます。たとえば、米国の 2 文字コードは "US" です。
定義済みの RegionInfo の名前は、RegionInfo クラスのトピックに一覧表示されています。国/地域の完全名を取得するには、DisplayName または EnglishName プロパティを使用します。
RegionInfo クラスのプロパティを表示する例を次に示します。
Imports System Imports System.Globalization Public Class SamplesRegionInfo Public Shared Sub Main() ' Displays the property values of the RegionInfo for "US". Dim myRI1 As New RegionInfo("US") 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) End Sub 'Main End Class 'SamplesRegionInfo 'This code produces the following output. ' ' Name: US ' DisplayName: United States ' EnglishName: United States ' IsMetric: False ' ThreeLetterISORegionName: USA ' ThreeLetterWindowsRegionName: USA ' TwoLetterISORegionName: US ' CurrencySymbol: $ ' ISOCurrencySymbol: USD
using System; using System.Globalization; public class SamplesRegionInfo { public static void Main() { // Displays the property values of the RegionInfo for "US". RegionInfo myRI1 = new RegionInfo( "US" ); 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 ); } } /* This code produces the following output. Name: US DisplayName: United States EnglishName: United States IsMetric: False ThreeLetterISORegionName: USA ThreeLetterWindowsRegionName: USA TwoLetterISORegionName: US CurrencySymbol: $ ISOCurrencySymbol: USD */
using namespace System; using namespace System::Globalization; int main() { // Displays the property values of the RegionInfo for "US". RegionInfo^ myRI1 = gcnew RegionInfo( "US" ); 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 ); } /* This code produces the following output. Name: US DisplayName: United States EnglishName: United States IsMetric: False ThreeLetterISORegionName: USA ThreeLetterWindowsRegionName: USA TwoLetterISORegionName: US CurrencySymbol: $ ISOCurrencySymbol: USD */
import System.*; import System.Globalization.*; public class SamplesRegionInfo { public static void main(String[] args) { // Displays the property values of the RegionInfo for "US". RegionInfo myRI1 = new RegionInfo("US"); Console.WriteLine(" Name: {0}", myRI1.get_Name()); Console.WriteLine(" DisplayName: {0}", myRI1.get_DisplayName()); Console.WriteLine(" EnglishName: {0}", myRI1.get_EnglishName()); Console.WriteLine(" IsMetric: {0}", System.Convert.ToString( myRI1.get_IsMetric())); Console.WriteLine(" ThreeLetterISORegionName: {0}", myRI1.get_ThreeLetterISORegionName()); Console.WriteLine(" ThreeLetterWindowsRegionName: {0}", myRI1.get_ThreeLetterWindowsRegionName()); Console.WriteLine(" TwoLetterISORegionName: {0}", myRI1.get_TwoLetterISORegionName()); Console.WriteLine(" CurrencySymbol: {0}", myRI1.get_CurrencySymbol()); Console.WriteLine(" ISOCurrencySymbol: {0}", myRI1.get_ISOCurrencySymbol()); } //main } //SamplesRegionInfo /* This code produces the following output. Name: US DisplayName: United States EnglishName: United States IsMetric: False ThreeLetterISORegionName: USA ThreeLetterWindowsRegionName: USA TwoLetterISORegionName: US CurrencySymbol: $ ISOCurrencySymbol: USD */
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
参照
- RegionInfo.Name プロパティのページへのリンク