英語で読む

次の方法で共有


CultureInfo.CurrentCulture プロパティ

定義

現在のスレッドとタスクベースの CultureInfo 非同期操作で使用されるカルチャを表す オブジェクトを取得または設定します。

C#
public static System.Globalization.CultureInfo CurrentCulture { get; set; }
C#
public static System.Globalization.CultureInfo CurrentCulture { get; }

プロパティ値

現在のスレッドとタスク ベースの非同期操作で使用されるカルチャ。

例外

プロパティが null に設定されています。

次の例では、現在のスレッドの と CurrentUICultureCurrentCulture変更する方法を示します。

C#
using System;
using System.Globalization;
using System.Threading;

public class Example0
{
   public static void Main()
   {
      // Display the name of the current culture.
      Console.WriteLine("CurrentCulture is {0}.", CultureInfo.CurrentCulture.Name);

      // Change the current culture to th-TH.
      CultureInfo.CurrentCulture = new CultureInfo("th-TH", false);
      Console.WriteLine("CurrentCulture is now {0}.", CultureInfo.CurrentCulture.Name);

      // Display the name of the current UI culture.
      Console.WriteLine("CurrentUICulture is {0}.", CultureInfo.CurrentUICulture.Name);

      // Change the current UI culture to ja-JP.
      CultureInfo.CurrentUICulture = new CultureInfo( "ja-JP", false );
      Console.WriteLine("CurrentUICulture is now {0}.", CultureInfo.CurrentUICulture.Name);
   }
}
// The example displays the following output:
//       CurrentCulture is en-US.
//       CurrentCulture is now th-TH.
//       CurrentUICulture is en-US.
//       CurrentUICulture is now ja-JP.

注釈

この API の詳細については、「 CultureInfo.CurrentCulture の補足 API 解説」を参照してください。

適用対象

製品 バージョン
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.0, 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0

こちらもご覧ください