전역 Windows Forms 및 Web Forms을 위한 문화권 관련 클래스

업데이트: 2007년 11월

날짜, 시간, 숫자, 통화 및 기타 정보를 표시하는 규칙은 각 문화권마다 다릅니다. System.Globalization 네임스페이스에는 문화권별 값을 표시하는 방법을 수정하는 데 사용할 수 있는 DateTimeFormatInfo, Calendar 및 NumberFormatInfo 같은 클래스가 있습니다.

문화권 설정 사용

그러나 대개는 제어판의 국가별 옵션이나 응용 프로그램에 저장되어 있는 문화권 설정을 사용하여 런타임에 자동으로 규칙을 결정하고 그에 따라 정보의 서식을 지정합니다. 문화권 설정에 대한 자세한 내용은 방법: Windows Forms 전역화를 위한 Culture 및 UI Culture 설정 또는 방법: ASP.NET 웹 페이지 전역화를 위한 Culture 및 UI Culture 설정을 참조하십시오. 문화권 설정에 따라 자동으로 정보의 서식을 지정하는 클래스를 문화권 관련 클래스라고 합니다. 문화권 관련 메서드로는 IFormattable.ToString, Console.WriteLineString.Format이 있습니다. 문화권 관련 함수(Visual Basic 언어)로는 MonthName과 WeekDayName이 있습니다.

예를 들어, 다음 코드에서는 ToString 메서드를 사용하여 현재 문화권의 통화에 대한 서식을 지정하는 방법을 보여 줍니다.

' Put the Imports statements at the beginning of the code module
Imports System.Threading
Imports System.Globalization
' Display a number with the culture-specific currency formatting
Dim MyInt As Integer = 100
Console.WriteLine(MyInt.ToString("C", Thread.CurrentThread.CurrentCulture))
// Put the using statements at the beginning of the code module
using System.Threading;
using System.Globalization;
// Display a number with the culture-specific currency formatting
int myInt = 100;
Console.WriteLine(myInt.ToString("C", Thread.CurrentThread.CurrentCulture));

문화권을 "fr-FR"로 설정하면 출력 창에 다음과 같은 결과가 나타납니다.

100,00

문화권을 "en-US"로 설정하면 출력 창에 다음과 같은 결과가 나타납니다.

$100.00

참고 항목

참조

MonthName 함수(Visual Basic)

WeekdayName 함수(Visual Basic)

IFormattable.ToString

DateTimeFormatInfo

NumberFormatInfo

Calendar

Console.WriteLine

String.Format

기타 리소스

응용 프로그램 전역화 및 지역화