je la ligne de code suivante:Quel est le problème avec ToLowerInvariant()?
var connectionString = configItems.
Find(item => item.Name.ToLowerInvariant() == "connectionstring");
VS 2010 analyse de code me dit ce qui suit:
Avertissement 7 CA1308: Microsoft.Globalization: Dans la méthode ... remplacer l'appel à 'string.ToLowerInvariant()' avec String.ToUpperInvariant().
Est-ce que cela signifie ToUpperInvariant()
est plus fiable?
Notez que l'aide 'string.Equals (item.Name, "connectionstring", StringComparison.OrdinalIgnoreCase)' est probablement la meilleure approche dans ce cas particulier. –
http://stackoverflow.com/questions/773703/normalization-of-strings-with-string-toupperinvariant – kenny