RegionInfo.TwoLetterISORegionName プロパティ
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
国/地域の ISO 3166 で定義されている 2 文字のコードを取得します。
public:
virtual property System::String ^ TwoLetterISORegionName { System::String ^ get(); };
public virtual string TwoLetterISORegionName { get; }
member this.TwoLetterISORegionName : string
Public Overridable ReadOnly Property TwoLetterISORegionName As String
プロパティ値
国/地域の ISO 3166 で定義されている 2 文字のコード。
例
次のコード例では、 RegionInfo クラスのプロパティを表示します。
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
*/
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
End Class
'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
注釈
RegionInfo名は、国/地域の ISO 3166 で定義されている 2 文字のコードの 1 つです。 たとえば、米国の 2 文字のコードは "US" です。
Important
場合によっては、 TwoLetterISORegionName プロパティに 2 文字を超える文字が含まれる場合があります。 たとえば、カリブ海地域の TwoLetterISORegionName プロパティの値は "029" です。
大文字と小文字は区別されません。 ただし、 Name、 TwoLetterISORegionName、および ThreeLetterISORegionName のプロパティは、適切なコードを大文字で返します。
Warning
RegionInfo オブジェクトを永続化したり、プロセス間で通信したりする場合は、2 文字の ISO リージョン コードではなく完全なカルチャ名を使用してインスタンス化する必要があります。 RegionInfoプロパティはスクリプトと言語に依存するため、リージョン コードのみを使用してRegionInfo オブジェクトをインスタンス化すると、コンテキストとデータが失われます。
定義済みの RegionInfo 名は ISO 3166: 国コードに記載されています。