Thread.CurrentCulture (Propiedad)
Obtiene o establece la referencia cultural del subproceso actual.

Espacio de nombres: System.Threading
Ensamblado: mscorlib (en mscorlib.dll)

Sintaxis

Visual Basic (Declaración)
Public Property CurrentCulture As CultureInfo
Visual Basic (Uso)
Dim instance As Thread
Dim value As CultureInfo

value = instance.CurrentCulture

instance.CurrentCulture = value
C#
public CultureInfo CurrentCulture { get; set; }
C++
public:
property CultureInfo^ CurrentCulture {
    CultureInfo^ get ();
    void set (CultureInfo^ value);
}
J#
/** @property */
public CultureInfo get_CurrentCulture ()

/** @property */
public void set_CurrentCulture (CultureInfo value)
JScript
public function get CurrentCulture () : CultureInfo

public function set CurrentCulture (value : CultureInfo)
XAML
No aplicable.

Valor de propiedad

CultureInfo que representa la información de referencia cultural del subproceso actual.
Excepciones

Tipo de excepciónCondición

NotSupportedException

La propiedad se establece en una referencia cultural neutra. Las referencias culturales neutras no se pueden utilizar para dar formato y analizar y, por consiguiente, no se pueden establecer como referencia cultural actual del subproceso.

ArgumentNullException

La propiedad está establecida en referencia null (Nothing en Visual Basic).

Ejemplo

En el ejemplo de código siguiente se muestra la instrucción de subprocesamiento que permite a la interfaz de usuario de un formulario Windows Forms mostrarse en la referencia cultural que se establece en el Panel de control. Se necesita código adicional.

Visual Basic
' Compile with option t:winexe /r:System.dll,System.Windows.Forms.dll.

Option Explicit
Option Strict

Imports System
Imports System.Threading
Imports System.Windows.Forms

Public Class UICulture
    Inherits Form

    Sub New()

        ' 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.
    End Sub

    <STAThreadAttribute> Shared Sub Main()
        Application.Run(New UICulture())
    End Sub

End Class
C#
// 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());
    }
}
C++
#using <system.dll>
#using <System.Drawing.dll>
#using <system.windows.forms.dll>

using namespace System;
using namespace System::Threading;
using namespace System::Windows::Forms;
ref class UICulture: public 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]
int main()
{
   Application::Run( gcnew UICulture );
}
J#
// Compile with option /t:winexe.
import System.*;
import System.Threading.*;
import System.Threading.Thread;
import System.Windows.Forms.*;

class UICulture extends Form
{
    public UICulture()
    {
        // Set the user interface to display in the
        // same culture as that set in Control Panel.
        Thread.get_CurrentThread().set_CurrentUICulture(
            Thread.get_CurrentThread().get_CurrentCulture());
        // Add additional code.
    } //UICulture


    /** @attribute STAThreadAttribute()
     */
    public static void main(String[] args)
    {
        Application.Run(new UICulture());
    } //main
} //UICulture
Seguridad de .NET Framework

Plataformas

Windows 98, Windows 2000 Service Pack 4, Windows CE, Windows Millennium, Windows Mobile para Pocket PC, Windows Mobile para Smartphone, Windows Server 2003, Windows XP Media Center, Windows XP Professional x64, Windows XP SP2, Windows XP Starter

Microsoft .NET Framework 3.0 es compatible con Windows Vista, Microsoft Windows XP SP2 y Windows Server 2003 SP1.

Información de versión

.NET Framework

Compatible con: 3.0, 2.0, 1.1, 1.0
Vea también

Page view tracker