c# IndexOf string search
Because you use the returned value of IndexOf() only to check if it is &gt; -1 a more readable way would be to use Contains() instead of IndexOf().   

Internally Contains() does mostly the same than your comparison of the returned value. In the reference source of Contains() you will find  

[Pure]
public bool Contains( string value ) {
    return ( IndexOf(value, StringComparison.Ordinal) &gt;=0 );
}  


while the counterpart of IndexOf() will look like so  

[Pure]
public int IndexOf(String value) {
    return IndexOf(value, StringComparison.CurrentCulture);
}  


The difference between these two methods by the meaning of the internally called IndexOf() method is the passed StringComparison parameter.  

By reading the documentation you will read in the remarks section  


  When you call a string comparison method such as String.Compare,
  String.Equals, or String.IndexOf, you should always call an overload
  that includes a parameter of type StringComparison so that you can
  specify the type of comparison that the method performs. For more
  information, see Best Practices for Using Strings.  


Let us check what that means by using the german word daß and compare the results from StringComparison.CurrentCulture, StringComparison.InvariantCulture and StringComparison.Ordinal  

Console.WriteLine("daß".IndexOf("daß", StringComparison.Ordinal));
Console.WriteLine("daß".IndexOf("dass", StringComparison.Ordinal));
Console.WriteLine("daß".IndexOf("dass", StringComparison.CurrentCulture));
Console.WriteLine("daß".IndexOf("dass", StringComparison.InvariantCulture));


this will yield the results  


  0
  -1
  0
  0  


As you see you need to know what you want to get returned by calling IndexOf(). If you need to know if the exact string is contained inside another string you shouldn't use the default IndexOf() method.