I put together a simple little search.
IEnumerable<Member> searchResults = (from m in members
where m.ScreenName.ToUpper().Contains(upperKeyword)
select m).AsEnumerable();
Then I realized this, if the user typed "keyword1 keyword2", this little query will always look for this exact string. So, I decided that I should probably separate the keywords
string[] keywords = upperKeyword.split(' ');
and then I ran into a problem. I can not do it:
IEnumerable<Member> searchResults = (from m in members
where m.ScreenName.ToUpper().Contains(keywords)
select m).AsEnumerable();
because it .Contains()does not accept an array. How could I do this?
source
share