C# Check if string contains values from collection

static List<string> testList = new List<string> { "111", "222" };static void Main(string[] args){    string testString = "test";    if (testList.Any(s => testString.Contains(s)))    {        Console.Write("found");        Console.Read();    }    else    {        Console.Write("NOT found");        Console.Read();    }}

Leave a Reply

Your email address will not be published. Required fields are marked *