I have an object which looks something like this
class MyObject
{
string Name;
string Description;
List<string> Keywords;
}
And when I’m searching through these, I have a List<MyObject> AllObjects, which I want to filter based on the Keywords
var query = Request["q"];
//will only return exact matches
var exactHits = GetAll().Where(x => x.Keywords.Contains(query));
//I want something like this
var searchHits = GetAll().Where(x => x.Keywords.Contains(Regex.Match(query)));
1 Answer