¿Podrían las comparaciones de cadenas realmente diferir según la cultura cuando se garantiza que la cadena no cambiará?
Estoy leyendo credenciales cifradas / cadenas de conexión de un archivo de configuración. Resharper me dice, "String.IndexOf (string) es específico de la cultura aquí" en esta línea:
if (line.Contains("host=")) {
_host = line.Substring(line.IndexOf(
"host=") + "host=".Length, line.Length - "host=".Length);
... y así lo quiere cambiar a:
if (line.Contains("host=")) {
_host = line.Substring(line.IndexOf("host=", System.StringComparison.Ordinal) + "host=".Length, line.Length - "host=".Length);
El valor que estoy leyendo siempre será "host =" independientemente de dónde se pueda implementar la aplicación. ¿Es realmente sensato agregar este bit "System.StringComparison.Ordinal"?
Más importante aún, ¿podría lastimar algo (usarlo)?