System.Globalization 命名空間
包含類別,其會定義與文化特性相關的資訊,包括語言、國家/地區、使用中的日曆、日期的格式模式、貨幣和數字,以及字串的排序次序。 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. 像是 StringInfo 和 TextInfo 這些類別會提供進階的全球化功能,包括 Surrogate 支援和文字項目處理。 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 |
實作區分文化特性 (Culture) 的字串比較的一組方法。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 |
提供有關特定文化特性 (Culture) 的資訊 (文化特性在 Unmanaged 程式碼開發中稱為「地區設定」(Locale))。**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 |
網際網路網域名稱支援使用非 ASCII 字元。Supports the use of non-ASCII characters for Internet domain names. 此類別無法獲得繼承。This class cannot be inherited. |
ISOWeek |
提供靜態成員以便支援 ISO 週日期,這是由國際標準組織 (ISO) 所發行 ISO 8601 日期和時間標準的一部分。Provides static members to support the ISO week date that is part of the ISO 8601 date and time standard issued by the International Organization for Standardization (ISO). |
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 |
決定數值字串引數中允許的樣式,這些引數是傳遞給整數及浮點數值型別的 |
TimeSpanStyles |
定義格式化選項,這些格式化選項自訂 ParseExact 和 TryParseExact 方法的字串剖析。Defines the formatting options that customize string parsing for the ParseExact and TryParseExact methods. |
UnicodeCategory |
定義字元的 Unicode 分類。Defines the Unicode category of a character. |
備註
下列 blog 包括 System.Globalization 命名空間和其類別的討論:The following blogs include discussions of the System.Globalization namespace and its classes:
這個命名空間中的兩個 .NET 類型 CultureAndRegionInfoBuilder 和 CultureAndRegionModifiers 都是在名為 sysglobl.dll 的元件中找到。Two of the .NET types in this namespace, CultureAndRegionInfoBuilder and CultureAndRegionModifiers, are found in an assembly named sysglobl.dll . 若要成功編譯使用這些類型的程式碼,請將參考加入至 sysglobl.dll。To successfully compile code that uses these types, add a reference to sysglobl.dll.