contains example c#
Example 1: c# string contains
bool b = s1.Contains("myString");
Example 2: check if string is in string[] c#
string stringToCheck = "text1";
string[] stringArray = { "text1", "testtest", "test1test2", "test2text1" };
foreach (string x in stringArray)
{
if (x == stringToCheck)
{
// Process...
}
}
Example 3: c# string contains
var str = "a string to search in";
bool isIn = str.Contains("a string");