i want to replace operator(==, >= ,>…) in the clause where of linq lambda with parameter passed in method
the method:
public IEnumerable<Localisation> GetByFiltre(string filter, string valeurDate1)
/*
filter has the value of an operator:
>
==
!=
>=
<=
*/
DateTime dt = Convert.ToDateTime(valeurDate1);
var mod = from o in new GpsContext().Locals.Where(loc => loc.Date == dt)
i want to replace == in the clause where with the parameter filter
to obtain something like this
var mod = from o in new GpsContext().Locals.Where(loc => loc.Date filter dt)
any body knows how to make it work ?
I think it’s better to make dictionary out of string filters and corresponding delegates.