What is wrong with ToLowerInvariant()?

Google gives a hint pointing to CA1308: Normalize strings to uppercase

It says:

Strings should be normalized to uppercase. A small group of characters, when they are converted to lowercase, cannot make a round trip. To make a round trip means to convert the characters from one locale to another locale that represents character data differently, and then to accurately retrieve the original characters from the converted characters.

So, yes – ToUpper is more reliable than ToLower.

In the future I suggest googling first – I do that for all those FxCop warnings I get thrown around 😉 Helps a lot to read the corresponding documentation 😉

Leave a Comment