RegionInfo クラス
アセンブリ: mscorlib (mscorlib.dll 内)


CultureInfo とは対照的に、RegionInfo はユーザーの設定を表さず、ユーザーの言語またはカルチャに依存しません。
RegionInfo 名は、ISO 3166 で国/地域に対して定義されている 2 文字のコードのいずれかになります。大文字と小文字の区別は特に重要ではありませんが、Name、TwoLetterISORegionName、ThreeLetterISORegionName の各プロパティは、対応するコードを大文字で返します。
このクラスと System.Globalization 名前空間のその他のクラスで受け入れられ、使用される定義済み RegionInfo 名の一覧は、次のとおりです。
国/地域 | ||
---|---|---|
ARE | ||
AM | ||
AT | ||
BY | ||
CAN | ||
DO | DOM | |
IN | ||
IS | ||
IT | ||
MY | ||
NO | NOR | |
PER | ||
THA | ||
US | ||
ISOCurrencySymbol プロパティが返す ISO 4217 通貨記号の一覧を次に示します。

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) Console.WriteLine() ' Compares the RegionInfo above with another RegionInfo created using CultureInfo. Dim myRI2 As New RegionInfo(New CultureInfo("en-US", False).LCID) If myRI1.Equals(myRI2) Then Console.WriteLine("The two RegionInfo instances are equal.") Else Console.WriteLine("The two RegionInfo instances are NOT equal.") End If 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 ' 'The two RegionInfo instances are equal.
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 ); Console.WriteLine(); // Compares the RegionInfo above with another RegionInfo created using CultureInfo. 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." ); } } /* 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 The two RegionInfo instances are equal. */
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 ); Console::WriteLine(); // Compares the RegionInfo above with another RegionInfo created using CultureInfo. RegionInfo^ myRI2 = gcnew RegionInfo( (gcnew 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." ); } /* 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 The two RegionInfo instances are equal. */
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()); Console.WriteLine(); // Compares the RegionInfo above with another RegionInfo // created using CultureInfo. RegionInfo myRI2 = new RegionInfo((new CultureInfo("en-US", false)).get_LCID()); if ( myRI1.Equals(myRI2)) { Console.WriteLine("The two RegionInfo instances are equal."); } else { Console.WriteLine("The two RegionInfo instances are NOT equal."); } } //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 The two RegionInfo instances are equal. */

System.Globalization.RegionInfo


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 コンストラクタ (Int32)
アセンブリ: mscorlib (mscorlib.dll 内)



カルチャ識別子は、対応する各国語サポート ロケール識別子に割り当てられます。カルチャ識別子の一覧は、CultureInfo クラスのトピックにあります。
新しい RegionInfo オブジェクトの名前は、2 文字の言語コードと地域コードではなく、ISO 3166 で地域に対して定義された 2 文字コードです。たとえば、"英語 - 米国" カルチャのカルチャ識別子は 0x409 であり、地域名は "en-US" ではなく "US" になります。

異なる方法で作成された RegionInfo の 2 つのインスタンスを比較する例を次に示します。
Imports System Imports System.Globalization Public Class SamplesRegionInfo Public Shared Sub Main() ' Creates a RegionInfo using the ISO 3166 two-letter code. Dim myRI1 As New RegionInfo("US") ' Creates a RegionInfo using a CultureInfo.LCID. Dim myRI2 As New RegionInfo(New CultureInfo("en-US", False).LCID) ' Compares the two instances. If myRI1.Equals(myRI2) Then Console.WriteLine("The two RegionInfo instances are equal.") Else Console.WriteLine("The two RegionInfo instances are NOT equal.") End If End Sub 'Main End Class 'SamplesRegionInfo 'This code produces the following output. ' 'The two RegionInfo instances are equal.
using System; using System.Globalization; public class SamplesRegionInfo { public static void Main() { // Creates a RegionInfo using the ISO 3166 two-letter code. RegionInfo myRI1 = new RegionInfo( "US" ); // Creates a RegionInfo using a CultureInfo.LCID. RegionInfo myRI2 = new RegionInfo( new CultureInfo("en-US",false).LCID ); // Compares the two instances. if ( myRI1.Equals( myRI2 ) ) Console.WriteLine( "The two RegionInfo instances are equal." ); else Console.WriteLine( "The two RegionInfo instances are NOT equal." ); } } /* This code produces the following output. The two RegionInfo instances are equal. */
using namespace System; using namespace System::Globalization; int main() { // Creates a RegionInfo using the ISO 3166 two-letter code. RegionInfo^ myRI1 = gcnew RegionInfo( "US" ); // Creates a RegionInfo using a CultureInfo.LCID. RegionInfo^ myRI2 = gcnew RegionInfo( (gcnew CultureInfo( "en-US",false ))->LCID ); // Compares the two instances. if ( myRI1->Equals( myRI2 ) ) Console::WriteLine( "The two RegionInfo instances are equal." ); else Console::WriteLine( "The two RegionInfo instances are NOT equal." ); } /* This code produces the following output. The two RegionInfo instances are equal. */
import System.*; import System.Globalization.*; public class SamplesRegionInfo { public static void main(String[] args) { // Creates a RegionInfo using the ISO 3166 two-letter code. RegionInfo myRI1 = new RegionInfo("US"); // Creates a RegionInfo using a CultureInfo.LCID. RegionInfo myRI2 = new RegionInfo((new CultureInfo("en-US", false)).get_LCID()); // Compares the two instances. if (myRI1.Equals(myRI2)) { Console.WriteLine("The two RegionInfo instances are equal."); } else { Console.WriteLine("The two RegionInfo instances are NOT equal."); } } //main } //SamplesRegionInfo /* This code produces the following output. The two RegionInfo instances are equal. */

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 コンストラクタ (String)
アセンブリ: mscorlib (mscorlib.dll 内)



RegionInfo 名は、ISO 3166 で国/地域に対して定義されている 2 文字のコードのいずれか、特定カルチャ名、カスタム カルチャ名、または Windows 専用カルチャ名になります。大文字と小文字の区別は特に重要ではありませんが、Name、TwoLetterISORegionName、ThreeLetterISORegionName の各プロパティは、指定されたコードまたはカルチャ名を大文字で返します。
定義済みの RegionInfo の名前は、RegionInfo クラスのトピックに一覧表示されています。
RFC 1766 標準に準拠したカルチャ名は、"<languagecode2>-<country/regioncode2>" という形式になります。<languagecode2> は ISO 639-1 に基づく 2 桁の小文字コードであり、<country/regioncode2> は ISO 3166 に基づく 2 桁の大文字コードです。たとえば、米国の英語は "en-US" となります。2 文字の言語コードが存在しない場合は、ISO 639-2 から派生した 3 文字のコードを使用します。たとえば、3 文字のコード "div" は、ディベヒ語を使用するカルチャに対して使用します。一部のカルチャ名には、文字の種類を示すサフィックスが付きます。たとえば、"-Cyrl" はキリル文字を示し、"-Latn" はラテン文字を示します。定義済みの CultureInfo の名前は、CultureInfo クラスのトピックに一覧表示されています。
カルチャは、通常、インバリアント カルチャ、ニュートラル カルチャ、および特定カルチャの 3 つのセットにグループ化されます。
インバリアント カルチャは、カルチャ固有の設定ではありません。空の文字列 ("") を使用した名前で、またはカルチャ識別子 0x007F を使用することによって、インバリアント カルチャを指定できます。InvariantCulture は、インバリアント カルチャのインスタンスを取得します。この設定は、英語と関連付けられていますが、国や地域には関連付けられていません。これは、カルチャを必要とする Globalization 名前空間のほとんどのメソッドで使用できます。セキュリティの決定が文字列の比較や大文字/小文字の変換操作に依存する場合は、システムのカルチャ設定にかかわらず一定の動作を保証するために InvariantCulture を使用してください。ただし、インバリアント カルチャは、システム サービスなど、カルチャに依存しない結果を必要とするプロセスでだけ使用する必要があります。それ以外の場合に使用すると、言語として正しくない、またはカルチャに対して不適切な結果が生じます。
ニュートラル カルチャは、国や地域ではなく、言語に関連付けられているカルチャです。特定のカルチャは、1 つの言語、および 1 つの国または地域に関連付けられたカルチャです。たとえば、"fr" はニュートラル カルチャであり、"fr-FR" は特定のカルチャです。"zh-CHS" (簡体字中国語) および "zh-CHT" (繁体字中国語) はニュートラル カルチャです。
呼び出し時の注意 このコンストラクタは、特定のカルチャのみを受け入れます。ただし、一部のニュートラル カルチャ名は国/地域コードと同じであり、その名前が使用される場合、このコンストラクタは ArgumentException をスローしません。したがって、name の値としてカルチャ名を使用して RegionInfo を構築する前に、カルチャが InvariantCulture ではなく、そのカルチャの CultureInfo.IsNeutralCulture プロパティが false であることを確認する必要があります。
異なる方法で作成された RegionInfo の 2 つのインスタンスを比較する例を次に示します。
Imports System Imports System.Globalization Public Class SamplesRegionInfo Public Shared Sub Main() ' Creates a RegionInfo using the ISO 3166 two-letter code. Dim myRI1 As New RegionInfo("US") ' Creates a RegionInfo using a CultureInfo.LCID. Dim myRI2 As New RegionInfo(New CultureInfo("en-US", False).LCID) ' Compares the two instances. If myRI1.Equals(myRI2) Then Console.WriteLine("The two RegionInfo instances are equal.") Else Console.WriteLine("The two RegionInfo instances are NOT equal.") End If End Sub 'Main End Class 'SamplesRegionInfo 'This code produces the following output. ' 'The two RegionInfo instances are equal.
using System; using System.Globalization; public class SamplesRegionInfo { public static void Main() { // Creates a RegionInfo using the ISO 3166 two-letter code. RegionInfo myRI1 = new RegionInfo( "US" ); // Creates a RegionInfo using a CultureInfo.LCID. RegionInfo myRI2 = new RegionInfo( new CultureInfo("en-US",false).LCID ); // Compares the two instances. if ( myRI1.Equals( myRI2 ) ) Console.WriteLine( "The two RegionInfo instances are equal." ); else Console.WriteLine( "The two RegionInfo instances are NOT equal." ); } } /* This code produces the following output. The two RegionInfo instances are equal. */
using namespace System; using namespace System::Globalization; int main() { // Creates a RegionInfo using the ISO 3166 two-letter code. RegionInfo^ myRI1 = gcnew RegionInfo( "US" ); // Creates a RegionInfo using a CultureInfo.LCID. RegionInfo^ myRI2 = gcnew RegionInfo( (gcnew CultureInfo( "en-US",false ))->LCID ); // Compares the two instances. if ( myRI1->Equals( myRI2 ) ) Console::WriteLine( "The two RegionInfo instances are equal." ); else Console::WriteLine( "The two RegionInfo instances are NOT equal." ); } /* This code produces the following output. The two RegionInfo instances are equal. */
import System.*; import System.Globalization.*; public class SamplesRegionInfo { public static void main(String[] args) { // Creates a RegionInfo using the ISO 3166 two-letter code. RegionInfo myRI1 = new RegionInfo("US"); // Creates a RegionInfo using a CultureInfo.LCID. RegionInfo myRI2 = new RegionInfo((new CultureInfo("en-US", false)).get_LCID()); // Compares the two instances. if (myRI1.Equals(myRI2)) { Console.WriteLine("The two RegionInfo instances are equal."); } else { Console.WriteLine("The two RegionInfo instances are NOT equal."); } } //main } //SamplesRegionInfo /* This code produces the following output. The two RegionInfo instances are equal. */
カルチャ名を使用して RegionInfo のインスタンスを作成するコード例を次に示します。
Imports System Imports System.Globalization Public Class SamplesRegionInfo Public Shared Sub Main() ' Creates an array containing culture names. Dim myCultures() As String = {"", "ar", "ar-DZ", "en", "en-US"} Dim cul As String ' Creates a RegionInfo for each of the culture names. ' Note that "ar" is the culture name for the neutral culture "Arabic", ' but it is also the region name for the country/region "Argentina"; ' therefore, it does not fail as expected. Console.WriteLine("Without checks...") For Each cul In myCultures Try Dim myRI As New RegionInfo(cul) Catch e As ArgumentException Console.WriteLine(e.ToString()) End Try Next cul Console.WriteLine() Console.WriteLine("Checking the culture names first...") For Each cul In myCultures If cul = "" Then Console.WriteLine("The culture is the invariant culture.") Else Dim myCI As New CultureInfo(cul, False) If myCI.IsNeutralCulture Then Console.WriteLine("The culture {0} is a neutral culture.", cul) Else Console.WriteLine("The culture {0} is a specific culture.", cul) Try Dim myRI As New RegionInfo(cul) Catch e As ArgumentException Console.WriteLine(e.ToString()) End Try End If End If Next cul End Sub 'Main End Class 'SamplesRegionInfo 'This code produces the following output. ' 'Without checks... 'System.ArgumentException: Region name '' is not supported. 'Parameter name: name ' at System.Globalization.RegionInfo..ctor(String name) ' at SamplesRegionInfo.Main() 'System.ArgumentException: Region name 'en' is not supported. 'Parameter name: name ' at System.Globalization.CultureTableRecord..ctor(String regionName, Boolean useUserOverride) ' at System.Globalization.RegionInfo..ctor(String name) ' at SamplesRegionInfo.Main() ' 'Checking the culture names first... 'The culture is the invariant culture. 'The culture ar is a neutral culture. 'The culture ar-DZ is a specific culture. 'The culture en is a neutral culture. 'The culture en-US is a specific culture.
using System; using System.Globalization; public class SamplesRegionInfo { public static void Main() { // Creates an array containing culture names. String[] myCultures = new String[] { "", "ar", "ar-DZ", "en", "en-US" }; // Creates a RegionInfo for each of the culture names. // Note that "ar" is the culture name for the neutral culture "Arabic", // but it is also the region name for the country/region "Argentina"; // therefore, it does not fail as expected. Console.WriteLine( "Without checks..." ); foreach ( String cul in myCultures ) { try { RegionInfo myRI = new RegionInfo( cul ); } catch ( ArgumentException e ) { Console.WriteLine( e.ToString() ); } } Console.WriteLine(); Console.WriteLine( "Checking the culture names first..." ); foreach ( String cul in myCultures ) { if ( cul == "" ) { Console.WriteLine( "The culture is the invariant culture." ); } else { CultureInfo myCI = new CultureInfo( cul, false ); if ( myCI.IsNeutralCulture ) Console.WriteLine( "The culture {0} is a neutral culture.", cul ); else { Console.WriteLine( "The culture {0} is a specific culture.", cul ); try { RegionInfo myRI = new RegionInfo( cul ); } catch ( ArgumentException e ) { Console.WriteLine( e.ToString() ); } } } } } } /* This code produces the following output. Without checks... System.ArgumentException: Region name '' is not supported. Parameter name: name at System.Globalization.RegionInfo..ctor(String name) at SamplesRegionInfo.Main() System.ArgumentException: Region name 'en' is not supported. Parameter name: name at System.Globalization.CultureTableRecord..ctor(String regionName, Boolean useUserOverride) at System.Globalization.RegionInfo..ctor(String name) at SamplesRegionInfo.Main() Checking the culture names first... The culture is the invariant culture. The culture ar is a neutral culture. The culture ar-DZ is a specific culture. The culture en is a neutral culture. The culture en-US is a specific culture. */
using namespace System; using namespace System::Collections; using namespace System::Globalization; namespace Sample { public ref class SamplesRegionInfo { public: static void Work() { // Creates an array containing culture names. array <String^>^ commonCultures = {"", "ar", "ar-DZ", "en", "en-US"}; // Creates a RegionInfo for each of the culture names. // Note that "ar" is the culture name for the neutral // culture "Arabic", but it is also the region name for // the country/region "Argentina"; therefore, it does not // fail as expected. Console::WriteLine("Without checks..."); for each (String^ cultureID in commonCultures) { try { RegionInfo^ region = gcnew RegionInfo(cultureID); } catch (ArgumentException^ ex) { Console::WriteLine(ex); } } Console::WriteLine(); Console::WriteLine("Checking the culture" " names first..."); for each (String^ cultureID in commonCultures) { if (cultureID->Length == 0) { Console::WriteLine( "The culture is the invariant culture."); } else { CultureInfo^ culture = gcnew CultureInfo(cultureID, false); if (culture->IsNeutralCulture) { Console::WriteLine("The culture {0} is " "a neutral culture.", cultureID); } else { Console::WriteLine("The culture {0} is " "a specific culture.", cultureID); try { RegionInfo^ region = gcnew RegionInfo(cultureID); } catch (ArgumentException^ ex) { Console::WriteLine(ex); } } } } Console::ReadLine(); } }; } int main() { Sample::SamplesRegionInfo::Work(); return 0; } /* This code produces the following output. Without checks... System.ArgumentException: Region name '' is not supported. Parameter name: name at System.Globalization.RegionInfo..ctor(String name) at SamplesRegionInfo.Main() System.ArgumentException: Region name 'en' is not supported. Parameter name: name at System.Globalization.CultureTableRecord..ctor(String regionName, Boolean useUserOverride) at System.Globalization.RegionInfo..ctor(String name) at SamplesRegionInfo.Main() Checking the culture names first... The culture is the invariant culture. The culture ar is a neutral culture. The culture ar-DZ is a specific culture. The culture en is a neutral culture. The culture en-US is a specific culture. */
import System.*; import System.Globalization.*; public class SamplesRegionInfo { public static void main(String[] args) { // Creates an array containing culture names. String myCultures[] = new String[] { "", "ar", "ar-DZ", "en", "en-US" }; // Creates a RegionInfo for each of the culture names. // Note that "ar" is the culture name for the neutral culture "Arabic", // but it is also the region name for the country/region "Argentina"; // therefore, it does not fail as expected. Console.WriteLine("Without checks..."); for (int iCtr = 0; iCtr < myCultures.get_Length(); iCtr++) { String cul = (String)myCultures.get_Item(iCtr); try { RegionInfo myRI = new RegionInfo(cul); } catch (ArgumentException e) { Console.WriteLine(e.ToString()); } } Console.WriteLine(); Console.WriteLine("Checking the culture names first..."); for (int iCtr = 0; iCtr < myCultures.get_Length(); iCtr++) { String cul = (String)myCultures.get_Item(iCtr); if (cul.Equals("")) { Console.WriteLine("The culture is the invariant culture."); } else { CultureInfo myCI = new CultureInfo(cul, false); if (myCI.get_IsNeutralCulture()) { Console.WriteLine("The culture {0} is a neutral culture.", cul); } else { Console.WriteLine("The culture {0} is a specific culture." , cul); try { RegionInfo myRI = new RegionInfo(cul); } catch (ArgumentException e) { Console.WriteLine(e.ToString()); } } } } } //main } //SamplesRegionInfo /* This code produces the following output. Without checks... System.ArgumentException: Region name '' is not supported. Parameter name: name at System.Globalization.RegionInfo..ctor(String name) at SamplesRegionInfo.main(String[] args) System.ArgumentException: Region name 'en' is not supported. Parameter name: name at System.Globalization.CultureTableRecord..ctor(String regionName, Boolean useUserOverride) at System.Globalization.RegionInfo..ctor(String name) at SamplesRegionInfo.Main() Checking the culture names first... The culture is the invariant culture. The culture ar is a neutral culture. The culture ar-DZ is a specific culture. The culture en is a neutral culture. The culture en-US is a specific culture. */

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 コンストラクタ

名前 | 説明 |
---|---|
RegionInfo (Int32) | 指定したカルチャ識別子に関連付けられた国/地域に基づいて、RegionInfo クラスの新しいインスタンスを初期化します。 .NET Compact Framework によってサポートされています。 |
RegionInfo (String) | 名前で指定された国/地域または特定カルチャに基づいて、RegionInfo クラスの新しいインスタンスを初期化します。 .NET Compact Framework によってサポートされています。 |

RegionInfo プロパティ
RegionInfo メソッド

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 オーバーライドされます。 |
![]() | GetHashCode | オーバーライドされます。 現在の RegionInfo のハッシュ関数として機能します。ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 |
![]() | GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | ToString | オーバーライドされます。 現在の RegionInfo に対して指定されたカルチャ名、または ISO 3166 で定義された 2 文字の国/地域コードを含む文字列を返します。 |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |

RegionInfo メンバ
RegionInfo データ型で公開されるメンバを以下の表に示します。



名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 オーバーライドされます。 |
![]() | GetHashCode | オーバーライドされます。 現在の RegionInfo のハッシュ関数として機能します。ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 |
![]() | GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | ToString | オーバーライドされます。 現在の RegionInfo に対して指定されたカルチャ名、または ISO 3166 で定義された 2 文字の国/地域コードを含む文字列を返します。 |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |

- RegionInfoのページへのリンク