Is it possible to have a dynamic operator? I know I could parse it out and find the symbol just wondered if it was possible.

string aString = "5";
int a = 5;
int b = 6;
string op = "<";

//want to do something like dynamically without checking the value of op
if( a op b)

//want to use the same thing like this
Int32.TryParse(aString, out a);

Operator.TryParse(op, out );

just need to create my own class to do this? or is there somthing i am forgetting

appreciate your help

8 Years
Discussion Span
Last Post by Jugortha

I'm not going to do it this way, i just need a quick app put together

i have a testing application that is loading an xml file that has conditional operators in it

<Condition> < </Condition>

rather than doing a switch on the condition string, i wondered if it was possible to use something like i stated up above


If you have a class that leavrages your entire activity then you can implement IComparable interface method CompareTo() it is the best solution


yeh thats what i'll do, just trying to see if there was some trickery that i had forgot

thanks jugortha

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.