c# check if something is string code example
Example 1: 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 2: C# check something is string
if(value is string)
{
}