I have a list of partial strings that I need to match in a table. I'm using PredicateBuilder.
var predicate = PredicateBuilder.False<Name>();
List<string> names = new List<string>();
names.Add("test name"); **<===matches**
names.Add("test"); **<=== doesn't match**
predicate = predicate.Or(n => names.Contains(n.Company));
var results = (from n in Names
.AsExpandable()
.Where(predicate)
select(new{ n.Company}));
n.Company = "test name"
This will match if the n.Company is exactly "test name" but it doesn't match if I just use "test". How do I match a partial on a list.Contains?
You should change your code this way