How to include generic behaviour in contains string

Viewed 32

I want to search if my collection property string contain many words at the same time. here my code with LINQ:

queryResult = questions.Where(q => q.proposition.Any(p => p.Libelle.Contains("string1") && p.Libelle.Contains("string2")));

I want to modify p.Libelle.Contains("string1") && p.Libelle.Contains("string2") to make it generic because sometimes I have many strings to search not 2. So I have an array of string: string[] arrayStrings. How to make my code fetch for all propositions.Libelle that contains at the same time all the words in my arrayStrings. Maybe I have 5 words in some cases.

For example:

arrayStrings = [aa,bb,cc,ll,bb]

propositions.Libelle:

 aabbccllllllppplmo

 jjjkkkkk

 aakk

I want to show only record: (aabbccllllllppplmo) that contain all words in arrayStrings.

0 Answers
Related