Edit

Share via


CultureInfo.CurrentCulture Property

Definition

Gets or sets the CultureInfo object that represents the culture used by the current thread and task-based asynchronous operations.

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

Property Value

The culture used by the current thread and task-based asynchronous operations.

Exceptions

The property is set to null.

Examples

The following example demonstrates how to change the CurrentCulture and CurrentUICulture of the current thread.

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.

Remarks

For more information about this API, see Supplemental API remarks for CultureInfo.CurrentCulture.

Applies to

Product Versions

See also