c# - Use Operator from array in IF statement -


i trying use operator selected array in if statement. code below cannot compile it. there anyway around ?

string[] operators = new string[]{"<",">","=","!="};  decimal value = convert.todecimal(values[j]); var operator1 = (operators[convert.toint32(iquerytypelist[k])]); int jjj = convert.toint32(ntestvaluelist[k]);  if (value operator1 jjj) {     isactive = true; } else {     isactive = false; } 

one way perform string comparison either if-else chain or switch statement. don't know exact syntax c#, consider following pseudocode:

if (operator1.equals("<"))     isactive = value < jjj // etc. 

Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -