string includes c# code example
Example 1: c# string contains
bool b = s1.Contains("myString");
Example 2: c# string contains
var str = "a string to search in";
bool isIn = str.Contains("a string");
Example 3: c# check if string contains value
string s1 = "The quick brown fox jumps over the lazy dog";
string s2 = "fox";
bool b = s1.Contains(s2);
Console.WriteLine("'{0}' is in the string '{1}': {2}",
s2, s1, b);
if (b) {
int index = s1.IndexOf(s2);
if (index >= 0)
Console.WriteLine("'{0} begins at character position {1}",
s2, index + 1);
}