public static bool TryParseOperator(char op, out Operator oper) { Operator temp = new Operator(op); if (temp.oper == basicOperators.NONE) { oper = null; return false; } oper = temp; return true; }
private Operator(char op) { switch (op) { case '+': this.oper = basicOperators.ADD; break; case '-': this.oper = basicOperators.SUBTRACT; break; case '*': this.oper = basicOperators.MULTIPLY; break; case '/': this.oper = basicOperators.DIVIDE; break; default: this.oper = basicOperators.NONE; break; } }