0

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

2
Contributors
5
Replies
6
Views
8 Years
Discussion Span
Last Post by Jugortha
0

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

<Variable>numIterations</Value>
<Condition> < </Condition>
<LimitNum>10</LimitNum>

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

0

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

0

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.