private bool ShouldDisplayPhrase(SelectableItem <Phrase> phrase) { string[] searchTerms = PhraseSearchTerm.Split(' '); string[] phraseParts = phrase.Item.Pinyin.Split(' '); return(searchTerms.All(searchTerm => phraseParts.Any(phrasePart => phrasePart.StartsWith(searchTerm)))); }
private bool DisplayAny(Phrase phrase) { string[] searchTerms = PhraseSearchTerm.Split(' '); string[] pinyinParts = phrase.Pinyin.Split(' '); string[] englishParts = phrase.English.Split(' '); string[] hanziParts = phrase.Hanzi.Split(' '); return(searchTerms.All(searchTerm => pinyinParts.Any(p => p.StartsWith(searchTerm)) || englishParts.Any(p => p.StartsWith(searchTerm)) || hanziParts.Any(p => p.StartsWith(searchTerm)))); }