System.Globalization Namespace

System.Globalization 命名空间包含定义区域性相关信息的类,这些信息包括语言,国家/地区,正在使用的日历,日期、货币和数字的格式模式,以及字符串的排序顺序。 The System.Globalization namespace contains classes that define culture-related information, including language, country/region, calendars in use, format patterns for dates, currency, and numbers, and sort order for strings. 这些类对于编写全球化(国际化)应用程序很有用。 These classes are useful for writing globalized (internationalized) applications. 而像 StringInfoTextInfo 这样的类更是为我们提供了诸如代理项支持和文本元素处理等高级全球化功能。 Classes such as StringInfo and TextInfo provide advanced globalization functionalities, including surrogate support and text element processing.

Calendar

表示部门中的时间(如周、月和年)。 Represents time in divisions, such as weeks, months, and years.

CharUnicodeInfo

检索关于 Unicode 字符的信息。 Retrieves information about a Unicode character. 此类不能被继承。 This class cannot be inherited.

ChineseLunisolarCalendar

表示时间划分方式,例如“月”、“日”和“年”。 Represents time in divisions, such as months, days, and years. 年按农历计算,而日和月按阴阳历计算。 Years are calculated using the Chinese calendar, while days and months are calculated using the lunisolar calendar.

CompareInfo

实现用于区分区域性的字符串的一组方法。 Implements a set of methods for culture-sensitive string comparisons.

CultureAndRegionInfoBuilder

定义一个新型或基于其他区域性和国家/地区的自定义区域性。 Defines a custom culture that is new or based on another culture and country/region. 自定义区域性可以安装在计算机上,然后由运行在该计算机上的任何应用程序使用。 The custom culture can be installed on a computer and subsequently used by any application that is running on that computer. 此类不能被继承。 This class cannot be inherited.

CultureInfo

提供有关特定区域性(对于非托管代码开发,则称为“区域设置”)的信息。 Provides information about a specific culture (called a locale for unmanaged code development). 这些信息包括区域性的名称、书写系统、使用的日历、字符串的排序顺序以及对日期和数字的格式化设置。 The information includes the names for the culture, the writing system, the calendar used, the sort order of strings, and formatting for dates and numbers.

CultureNotFoundException

当方法尝试构造不可用的区域性时引发的异常。 The exception that is thrown when a method attempts to construct a culture that is not available.

DateTimeFormatInfo

提供有关日期和时间值格式的区域性特定信息。 Provides culture-specific information about the format of date and time values.

DaylightTime

定义夏时制周期。 Defines the period of daylight saving time.

EastAsianLunisolarCalendar

表示一种日历,它将时间分为月、日、年和纪元,并且其日期基于太阳和月亮的循环。 Represents a calendar that divides time into months, days, years, and eras, and has dates that are based on cycles of the sun and the moon.

GlobalizationExtensions

提供与全球化相关的扩展方法。 Provides globalization-related extension methods.

GregorianCalendar

表示公历。 Represents the Gregorian calendar.

HebrewCalendar

表示希伯来历。 Represents the Hebrew calendar.

HijriCalendar

表示回历。 Represents the Hijri calendar.

IdnMapping

支持 Internet 域名使用非 ASCII 字符。 Supports the use of non-ASCII characters for Internet domain names. 此类不能被继承。 This class cannot be inherited.

JapaneseCalendar

表示日本历。 Represents the Japanese calendar.

JapaneseLunisolarCalendar

表示时间划分方式,例如“月”、“日”和“年”。 Represents time in divisions, such as months, days, and years. 年按日本历计算,而日和月则按阴阳历计算。 Years are calculated as for the Japanese calendar, while days and months are calculated using the lunisolar calendar.

JulianCalendar

表示儒略历。 Represents the Julian calendar.

KoreanCalendar

表示韩国历。 Represents the Korean calendar.

KoreanLunisolarCalendar

表示时间划分方式,例如“月”、“日”和“年”。 Represents time in divisions, such as months, days, and years. “年”采用公历计算,而“日”和“月”则采用阴阳历计算。 Years are calculated using the Gregorian calendar, while days and months are calculated using the lunisolar calendar.

NumberFormatInfo

提供用于对数字值进行格式设置和分析的区域性特定信息。 Provides culture-specific information for formatting and parsing numeric values.

PersianCalendar

表示波斯历。 Represents the Persian calendar.

RegionInfo

包含国家/地区的相关信息。 Contains information about the country/region.

SortKey

表示将字符串映射到其排序关键字的映射结果。 Represents the result of mapping a string to its sort key.

SortVersion

提供用于比较和排序字符串的 Unicode 版本的相关信息。 Provides information about the version of Unicode used to compare and order strings.

StringInfo

提供将字符串拆分为文本元素和循环访问这些文本元素的功能。 Provides functionality to split a string into text elements and to iterate through those text elements.

TaiwanCalendar

表示中国台湾日历。 the Taiwan calendar.

TaiwanLunisolarCalendar

表示中国台湾阴阳历。 Represents the Taiwan lunisolar calendar. 在台湾日历中,年按公历计算,而日和月则按阴阳历计算。 As for the Taiwan calendar, years are calculated using the Gregorian calendar, while days and months are calculated using the lunisolar calendar.

TextElementEnumerator

枚举字符串的文本元素。 Enumerates the text elements of a string.

TextInfo

定义特定于书写系统的文本属性和行为,如大小写。 Defines text properties and behaviors, such as casing, that are specific to a writing system.

ThaiBuddhistCalendar

表示泰国佛教日历。 Represents the Thai Buddhist calendar.

UmAlQuraCalendar

表示沙特阿拉伯 (Um Al Qura) 回历。 Represents the Saudi Hijri (Um Al Qura) calendar.

枚举

CalendarAlgorithmType

指定日历是阳历、阴历还是阴阳历。 Specifies whether a calendar is solar-based, lunar-based, or lunisolar-based.

CalendarWeekRule

定义用于确该年第一周的不同规则。 Defines different rules for determining the first week of the year.

CompareOptions

定义要用于 CompareInfo 的字符串比较选项。 Defines the string comparison options to use with CompareInfo.

CultureAndRegionModifiers

指定定义 CultureAndRegionInfoBuilder 对象的常数。 Specifies constants that define a CultureAndRegionInfoBuilder object.

CultureTypes

定义可以使用 GetCultures(CultureTypes) 方法检索的区域性列表的类型。 Defines the types of culture lists that can be retrieved using the GetCultures(CultureTypes) method.

DateTimeStyles

定义用来自定义某些日期和事件分析方法的字符串分析的格式选项。 Defines the formatting options that customize string parsing for some date and time parsing methods.

DigitShapes

指定特定于区域的数字显示方式。 Specifies the culture-specific display of digits.

GregorianCalendarTypes

定义其他语言版本的公历。 Defines the different language versions of the Gregorian calendar.

NumberStyles

确定数字字符串参数中允许的样式,这些参数已传递到整数和浮点数类型的 ParseTryParse 方法。 Determines the styles permitted in numeric string arguments that are passed to the Parse and TryParse methods of the integral and floating-point numeric types.

TimeSpanStyles

定义一些格式设置选项,这些选项可自定义 ParseExactTryParseExact 方法的字符串分析方法。 Defines the formatting options that customize string parsing for the ParseExact and TryParseExact methods.

UnicodeCategory

定义字符的 Unicode 类别。 Defines the Unicode category of a character.

注解

以下 MSDN 博客包括讨论System.Globalization命名空间及其类:The following MSDN blogs include discussions of the System.Globalization namespace and its classes:

此命名空间中类型的两个注意CultureAndRegionInfoBuilderCultureAndRegionModifiers,名为 sysglobl.dll 程序集中找到。Note that two of the types in this namespace, CultureAndRegionInfoBuilder and CultureAndRegionModifiers, are found in an assembly named sysglobl.dll. 已成功编译使用这些类型的代码需要添加对 sysglobl.dll 的引用。Successfully compiling code that uses these types requires that you add a reference to sysglobl.dll.