Culture-Insensitive String Operations
The culture-sensitive string operations described in the topic Comparing and Sorting Data for a Specific Culture can be an advantage if you are creating applications designed to display results to users on a per-culture basis. By default, culture-sensitive methods obtain the culture to use from the CurrentCulture property for the current thread. For more information about how this property is set, see Using the CurrentCulture Property.
Note that culture-sensitive string operations are not always the desired behavior. Using culture-sensitive operations when results should be independent of culture can cause application code to fail on cultures with Custom Case Mappings and Sorting Rules.
Whether string operations should be culture-sensitive or culture-insensitive depends on how your application uses the results. String operations that display results to the user should typically be culture-sensitive. For example, if an application displays a sorted list of localized strings in a list box, the application should perform a culture-sensitive sort.
Results of string operations that are used internally should typically be culture-insensitive. In general, if the application is working with file names, persistence formats, or symbolic information that is not displayed to the user, results of string operations should not vary by culture. For example, if an application compares a string to determine whether it is a recognized XML tag, the comparison should not be culture-sensitive. In addition, if a security decision is based on the result of a string comparison or case change operation, the operation should be culture-insensitive to ensure that the result is not affected by the value of CurrentCulture.
Whether or not you are developing an application that includes code to handle localization and globalization issues, you should be aware of the .NET Framework methods that retrieve culture-sensitive results by default. The purpose of this topic is to illustrate the correct way for your applications to use these methods to obtain culture-insensitive results.