I'd like convert string to ConditionalOperator, few sample :
- "and" to &&
- "or" to ||
- "greatherthan" to >=
- "contains" to .Contains
Something like this :
public static class Extension
{
public static Operator ConditionalOperator(this string logic)
{
switch (logic)
{
case "and": return // return && conditionaloperator
case "or": return // return || conditionaloperator
case "greatherthan": return // return >= conditionaloperator
}
}
}
The second argument is not all the time a string but can be int, double, bool, ...
I'd like build something like : ConditionalOperator("==", "StringToSearch") return a Func<>
Do you have an idea how to do this ?
Thanks,
Update 1, to clarify:
I received a list of object "Filter"
The "FilterOperator" all possible values for a CondtionalOperator.
OperatororOpertor? What is the second argument?Containswith anint? Or abool?