Up to this point, we’ve quietly ignored a significantly complicating factor in string manipulation: the fact that the rules for text vary considerably among cultures.
There are also lots of different types of rules in operation, from
the characters to use for particular types of separators, to the natural
sorting order for characters and strings. I’ve already called out an
example where the output on my UK English machine was different from that on a U.S. English
computer. As another very simple example, the decimal number we write as
1.8 in U.S. or UK English would be
1,8 in French. For the .NET
Framework, these rules are encapsulated in an object of the type
CultureInfo class makes
certain commonly used cultures accessible through static properties.
CurrentCulture returns the default
culture, used by all the culture-sensitive methods if you don’t supply a
specific culture to a suitable overload. This value can be controlled on a
per-thread basis, and defaults to the Windows default user locale. Another
per-thread value is the
CurrentUICulture. By default, this is based on
the current user’s personally selected preferred language, falling back on
the operating system default if the user hasn’t selected anything. This
culture determines which resources the system uses when looking up
localized resources such as strings.
CurrentUICulture may sound very similar, but are often different. For example, ...