I have to filter a list of objects.
The filter should be composed by users using logical OR / AND operators, and grouping using brackets.
say, something like this:
Say, we have object MyPerson and its properties Prop1, Prop2, etc...
Having myPersons list the user could filter elements: say Prop1 == aValue AND Prop2 < otherValue OR Prop2 > thirdvalue etc...
Now, I can build the chain of expression from the atoms (thanks to Jon Skeet from this question), like this:
Func<Person, bool> isAdult = person => person.Age > 18;
Func<Person, bool> isInParis = person => person.Location == "Paris";
var adultInParis = And(isAdult, isInParis);
My problem now is to transform the strings from the grid "Age", ">", "18" in the function expression "person.Age > 18", in order to link with an other one from the other row.