c# string contains with null check code example Example: c# string contains bool b = s1.Contains("myString");