Linq search any words in a term

I have a requirement to search an IQueryable list of words in a search expression.

I am currently working, but for an exact match.

list.Where(x => x.MyList.Any(y => y.ToSearch.ToLower().Contains(searchTerm.ToLower())));


I need someone to search for search results, it should be:

"search terms" "other search query"

I'm not sure what the best way to do this in linq can anyone help?


source to share

1 answer

//split the search terms by space
var searchWords = searchTerm.ToLower().Split( " ".ToCharArray(), 

//check if any of those search terms is present
list.Where(x => x.MyList.Any(y => 




All Articles