How to check if a string contains any element of a List<string>?
c#, contains, list, string
Solution
The correct formulation is
list2.Any(s => str.Contains(s))
This is read as "does `list2` include any string `s` such that `str` contains `s`?".
Problem
I have an if statement, where I would like to check, if a string contains any item of a `list<string>`. ``` if (str.Contains(list2.Any()) && str.Contains(ddl_language.SelectedValue)) { lstpdfList.Items.Add(str); } ```