Thread.CurrentCulture 속성

정의

현재 스레드에 대한 문화권을 가져오거나 설정합니다.

public:
 property System::Globalization::CultureInfo ^ CurrentCulture { System::Globalization::CultureInfo ^ get(); void set(System::Globalization::CultureInfo ^ value); };
public System.Globalization.CultureInfo CurrentCulture { get; set; }
member this.CurrentCulture : System.Globalization.CultureInfo with get, set
Public Property CurrentCulture As CultureInfo

속성 값

CultureInfo

현재 스레드에 대한 문화권을 나타내는 개체입니다.

예외

속성이 null로 설정됩니다.

.NET Core 및 .NET 5 +만 해당: 다른 스레드에서 스레드의 문화권을 읽거나 쓰는 것은 지원 되지 않습니다.

예제

다음 예제에서는 제어판에 설정 된 문화권에서 표시 하는 Windows Forms 애플리케이션의 사용자 인터페이스를 허용 하는 스레딩 문을 보여 줍니다. 추가 코드가 필요 합니다.

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


int main()
{
   Application::Run( gcnew UICulture );
}
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());
    }
}
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

    Shared Sub Main()
        Application.Run(New UICulture())
    End Sub
End Class

설명

CultureInfo이 속성에서 반환 하는 개체와 연결 된 개체는 날짜, 시간, 숫자, 통화 값, 텍스트 정렬 순서, 대/소문자 규칙 및 문자열 비교에 대 한 기본 형식을 결정 합니다. 참조 된 CultureInfo 문화권 이름 및 식별자, 고정, 중립 및 특정 문화권 간의 차이점에 대해 자세히 알아보려면 클래스 및 애플리케이션 도메인과 스레드 방식으로 문화권 정보에 영향을 줍니다. CultureInfo.CurrentCulture스레드의 기본 문화권이 결정 되는 방법 및 사용자가 컴퓨터에 대 한 문화권 정보를 설정 하는 방법을 알아보려면 속성을 참조 하세요.

중요

CurrentCulture속성이 현재 스레드가 아닌 다른 스레드에서 사용 될 경우 안정적으로 작동 하지 않습니다. .NET Framework에서 속성을 읽는 것은 안정적 이지만 현재 스레드 이외의 스레드에 대 한 설정은 설정할 수 없습니다. .NET Core에서 InvalidOperationException 스레드가 CurrentCulture 다른 스레드의 속성을 읽거나 쓰려고 하면이 throw 됩니다. 속성을 사용 하 여 CultureInfo.CurrentCulture 현재 문화권을 검색 하 고 설정 하는 것이 좋습니다.

.NET Framework 4 부터는 CurrentCulture 속성을 중립 문화권으로 설정할 수 있습니다. 이는 클래스의 동작이 변경 되었기 때문입니다 CultureInfo . 중립 문화권을 나타내는 경우 해당 속성 값 (특히 Calendar ,, CompareInfo DateTimeFormat , NumberFormatTextInfo 속성)은 이제 중립 문화권과 연결 된 특정 문화권을 반영 합니다. 이전 버전의 .NET Framework에서는 CurrentCulture NotSupportedException 중립 문화권이 할당 되었을 때 속성에서 예외를 throw 했습니다.

적용 대상