Thread.CurrentCulture Property
Gets or sets the culture for the current thread.
Assembly: mscorlib (in mscorlib.dll)
Property Value
Type: System.Globalization.CultureInfoA CultureInfo representing the culture for the current thread.
| Exception | Condition |
|---|---|
| NotSupportedException | The property is set to a neutral culture. Neutral cultures cannot be used in formatting and parsing and therefore cannot be set as the thread's current culture. |
| ArgumentNullException | The property is set to null. |
The following code example shows the threading statement that allows the user interface of a Windows Forms to display in the culture that is set in Control Panel. Additional code is needed.
// Compile with option /t:winexe. using System; using System.Threading; using System.Windows.Forms; class UICulture : Form { public UICulture() { // Set the user interface to display in the // same culture as that set in Control Panel. Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture; // Add additional code. } [STAThreadAttribute] static void Main() { Application.Run(new UICulture()); } }
- SecurityPermission
for setting the property. Associated enumeration: SecurityPermissionFlag.ControlThread
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.