I have to lists
I want to search the keywords in each Comment field of each record which in SQL would look like below
select * from MainList
where Comment like '%keyword1%'
or Comment like '%keyword2%'
... so on until the last keyword.
So far I have seen examples but usually for single keyword at a time only e.g. LINQ with non-lambda for Any Contains
What I would like is to search each record in MainList for any instance of any of my keyowrds all at once. something like:
var newList = MainList.Where(m => m.Comments.Contains(purposes))
I would prefer doing it in lambda syntax but if not possible, linq is also okay.
Answering for my and others' reference.
var newList = MainList.Where(m => keywords.Any(k => m.Comments.Contains(k))).ToList();