In general, you should try to see if there is another method that will answer your needs in a similar manner. For your example, Contains
is actually a wrapper method to IndexOf
, return true
if the returned value is greater than 0, otherwise false
. As it happens, the IndexOf
method has a number of overloads, one of which is IndexOf( string, StringComparison ): Int32
, which can be specified to honor or ignore case.
See String.IndexOf Method (String, StringComparison) (System) for more information, although the example is a little weird.
See StringComparison Enumeration (System) for the different options available when using the StringComparison
enumeration.