I have a scenario where I have custom configured column names, associated operators like < > = between etc. and then a value associated.
I’m trying to determine if it is possible to build up a LINQ query with a dynamic (string) where clause?
I’ve noticed the Predicate.OR Preditcate.AND stuff, but that is not quite what I’m talking about.
Any suggestions?
If you are talking about a string
Whereclause (rather than building the expression etc yourself) – then the Dynamic LINQ Library (in the 3.5 samples, IIRC) should suffice.Note that the example below is for database usage; but you can use it with LINQ-to-Objects by calling
.AsQueryable()on your in-memory data.