I have a interface in that user indicates some elements and operators between them and I should display the result.
User can build then a filter like p1 OP v1 OR p2 OP v2
where p1
and p2
are Person
properties, like Age, Name, Location
etc, v1
and v2
are comparative values(10, 'Maria', 'L.A.'), OP are comparison operators (=, <, >) and OR is a logical operator(can be also AND).
Eg:
Age > 18 AND Location = 'Paris'
, or another one like
Name Contains 'andro' AND Sex = 'm'
Having myPeople
collection and this filter string, how can I Build and apply this expression using Linq.Expressions?
I tried to use DynamicLinq, but actually I have a problem using "Where" on List<Person>
, apparently is not IQueryable
...