RegionInfo.Name プロパティ
ISO 3166 で定義された国/地域の 2 文字コードを取得します。
Public Overridable ReadOnly Property Name As String
[C#]
public virtual string Name {get;}
[C++]
public: __property virtual String* get_Name();
[JScript]
public function get Name() : String;
プロパティ値
ISO 3166 で定義された国/地域の 2 文字コード。
解説
RegionInfo.Name プロパティは、ISO 3166 で定義された国/地域の 2 文字のコードの 1 つです。たとえば、米国の 2 文字コードは "US" です。
このプロパティは、 TwoLetterISORegionName プロパティと同じ値を返します。
大文字と小文字の区別は特に重要ではありませんが、 Name 、 TwoLetterISORegionName 、 ThreeLetterISORegionName の各プロパティは、対応するコードを大文字で返します。
定義済みの RegionInfo の名前は、 RegionInfo クラスのトピックに一覧表示されています。
国/地域の完全名を取得するには、 DisplayName または EnglishName を使用します。
使用例
[Visual Basic, C#, C++] 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
[C#]
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
*/
[C++]
#using <mscorlib.dll>
using namespace System;
using namespace System::Globalization;
int main() {
// Displays the property values of the RegionInfo for "US".
RegionInfo* myRI1 = new RegionInfo( S"US" );
Console::WriteLine( S" Name: {0}", myRI1->Name );
Console::WriteLine( S" DisplayName: {0}", myRI1->DisplayName );
Console::WriteLine( S" EnglishName: {0}", myRI1->EnglishName );
Console::WriteLine( S" IsMetric: {0}", __box(myRI1->IsMetric));
Console::WriteLine( S" ThreeLetterISORegionName: {0}", myRI1->ThreeLetterISORegionName );
Console::WriteLine( S" ThreeLetterWindowsRegionName: {0}", myRI1->ThreeLetterWindowsRegionName );
Console::WriteLine( S" TwoLetterISORegionName: {0}", myRI1->TwoLetterISORegionName );
Console::WriteLine( S" CurrencySymbol: {0}", myRI1->CurrencySymbol );
Console::WriteLine( S" 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
*/
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET
参照
RegionInfo クラス | RegionInfo メンバ | System.Globalization 名前空間 | EnglishName | DisplayName | TwoLetterISORegionName | ThreeLetterISORegionName | ThreeLetterWindowsRegionName