This method uses the casing rules of the current culture to convert each character in the current instance to its uppercase equivalent. If a character does not have an uppercase equivalent, it is included unchanged in the returned string.
This method does not modify the value of the current instance. Instead, it returns a new string in which all characters in the current instance are converted to uppercase.
The string.ToUpper method is often used to convert a string to uppercase so that it can be used in a case-insensitive comparison. A better method to perform case-insensitive comparison is to call a string comparison method that has a StringComparison parameter whose value you set to StringComparison.CurrentCultureIgnoreCase for a culture-sensitive, case-insensitive comparison.
The casing operation that results from calling the string.ToUpper method takes the casing conventions of the current culture into account. If you need the lowercase or uppercase version of an operating system identifier, such as a file name, named pipe, or registry key, use the string.ToLowerInvariant or string.ToUpperInvariant method. This produces the same result in every culture (unlike the string.ToUpper method) and performs more efficiently.