I have a
List<string> words = new List<string> {"word1", "word2", "word3"};
And i want to check using linq if my string contains ANY of these words; Smthng like:
var q = myText.ContainsAny(words);
And the second, if i have a list of sentences too:
List<string> sentences = new List<string> { "sentence1 word1" , "sentence2 word2" , "sentence3 word3"};
and also neet to check if any of these sentence contains any of these words!
var q = sentences.Where(s=>words.Any(s.text))....
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…