執行不區分文化特性的字串作業Performing culture-insensitive string operations

執行區分文化特性字串作業的大部分 .NET Framework 方法預設會提供方法多載,讓您藉由傳遞 CultureInfo 參數,明確地指定要使用的文化特性。Most .NET Framework methods that perform culture-sensitive string operations by default provide method overloads that allow you to explicitly specify the culture to use by passing a CultureInfo parameter. 這些多載可讓您消除大小寫對應和排序規則中的文化特性變化,保證您可以得到不區分文化特性的結果。These overloads allow you to eliminate cultural variations in case mappings and sorting rules and guarantee culture-insensitive results.

本節提供下列主題,以示範如何使用預設會區分文化特性的 .NET Framework 方法來執行不區分文化特性的字串作業。This section provides the following topics to demonstrate how to perform culture-insensitive string operations using .NET Framework methods that are culture-sensitive by default.

本節內容In this section

執行不區分文化特性的字串比較Performing Culture-Insensitive String Comparisons
描述如何使用 String.CompareString.CompareTo 方法執行不區分文化特性的字串比較。Describes how to use the String.Compare and String.CompareTo methods to perform culture-insensitive string comparisons.

執行不區分文化特性的大小寫變更Performing Culture-Insensitive Case Changes
描述如何使用 String.ToUpperString.ToLowerChar.ToUpperChar.ToLower 方法執行不區分文化特性的大小寫變更。Describes how to use the String.ToUpper, String.ToLower, Char.ToUpper, and Char.ToLower methods to perform culture-insensitive case changes.

在集合中執行不區分文化特性的字串作業Performing Culture-Insensitive String Operations in Collections
描述如何使用 CaseInsensitiveComparerCaseInsensitiveHashCodeProvider 類別、SortedListArrayList.SortCollectionsUtil.CreateCaseInsensitiveHashtable,在集合中執行不區分文化特性的作業。Describes how to use the CaseInsensitiveComparer, CaseInsensitiveHashCodeProvider class, SortedList, ArrayList.Sort and CollectionsUtil.CreateCaseInsensitiveHashtable to perform culture-insensitive operations in collections.

在陣列中執行不區分文化特性的字串作業Performing Culture-Insensitive String Operations in Arrays
描述如何使用 Array.SortArray.BinarySearch 方法,在陣列中執行不區分文化特性的作業。Describes how to use the Array.Sort and Array.BinarySearch methods to perform culture-insensitive operations in arrays.

不區分文化特性的字串之作業Culture-Insensitive String Operations
描述為何您應該注意對字串執行作業時的文化特性,並提供指導方針來指出何時該執行區分文化特性的作業,何時該執行不區分文化特性的作業。Describes why you should be aware of culture when performing operations on strings and provides guidelines for when to perform culture-sensitive operations and when to perform culture-insensitive operations.

另請參閱See also