Code for .Contains() is simply:
public bool Contains( string value ) {
return ( IndexOf(value, StringComparison.Ordinal) >=0 );
}
so it's just a convenience method
>My thinking was the .Contains() is faster. This is simply based on my extensive VFP experience (bg). In VFP string manipulations are very fast. And the .IndexOf() "looks" like it would have to build an array first and then apply it. But I am probably "overthinking" it :)
>Thank you.
>
>>Now that Craig's reminded me I'd use .IndexOf() - at least for your specific need. :-}
>>>If it were up to you, would you use .Contains() or .IndexOf()?
>>>
>>>>Another way is variable.IndexOf("substring"). It will return -1 if it doesn't exist