LINQ query to match multiple words

Viewed 10944

I've been trying to solve this problem all day, and haven't found a solution that truly works. When I search for some data, I want to filter out the data based on multiple words.

My input value is split up by using the standard .Split-function.

string[] searchstrings = MessageResult.Split(' ');

I've made a query (which obviously doesn't work properly) that tries to filter out all the entries that matches every string in searchstrings.

                    var suggestions = (from a in query
                               from w in searchstrings
                               where a.Message.ToLower().Contains(w.ToLower())
                               select a).Distinct();

query is my variable which has all the data. How can I make this query to actually only match out entries that includes every string in searchstrings?

2 Answers
Related