if variable contains c# code example Example: c# string contains var str = "a string to search in"; bool isIn = str.Contains("a string");