Este artículo se tradujo automáticamente. Para ver el artículo en inglés, active la casilla Inglés. Además, puede mostrar el texto en inglés en una ventana emergente si mueve el puntero del mouse sobre el texto.
Traducción
Inglés

Propiedad Thread.CurrentCulture

 

Publicado: octubre de 2016

Obtiene o establece la referencia cultural del subproceso actual.

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

public CultureInfo CurrentCulture {
	get;
	[SecurityPermissionAttribute(SecurityAction.Demand, ControlThread = true)]
	set;
}

Valor de propiedad

Type: System.Globalization.CultureInfo

Objeto que representa la referencia cultural del subproceso actual.

Exception Condition
ArgumentNullException

La propiedad se establece en null.

The T:System.Globalization.CultureInfo object that is returned by this property, together with its associated objects, determine the default format for dates, times, numbers, currency values, the sorting order of text, casing conventions, and string comparisons. See the T:System.Globalization.CultureInfo class to learn about culture names and identifiers, the differences between invariant, neutral, and specific cultures, and the way culture information affects threads and application domains. See the P:System.Globalization.CultureInfo.CurrentCulture property to learn how a thread's default culture is determined, and how users set culture information for their computers.

Beginning with the net_v40_long, you can set the P:System.Threading.Thread.CurrentCulture property to a neutral culture. This is because the behavior of the T:System.Globalization.CultureInfo class has changed: When it represents a neutral culture, its property values (in particular, the P:System.Globalization.CultureInfo.Calendar, P:System.Globalization.CultureInfo.CompareInfo, P:System.Globalization.CultureInfo.DateTimeFormat, P:System.Globalization.CultureInfo.NumberFormat, and P:System.Globalization.CultureInfo.TextInfo properties) now reflect the specific culture that is associated with the neutral culture. In earlier versions of the .NET Framework, the P:System.Threading.Thread.CurrentCulture property threw a T:System.NotSupportedException exception when a neutral culture was assigned.

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.

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.
    }

    static void Main()
    {
        Application.Run(new UICulture());
    }
}

SecurityPermission

for setting the property. Associated enumeration: F:System.Security.Permissions.SecurityPermissionFlag.ControlThread

.NET Framework
Disponible desde 1.1
Biblioteca de clases portable
Se admite en: plataformas portátiles de .NET
Silverlight
Disponible desde 2.0
Windows Phone Silverlight
Disponible desde 7.0
Volver al principio
Mostrar: