you should also check (depending on where the string comes from) check if you got an assignment with some string
string op = "+"; int sign = ((op == "+") ? 1 : op.Length == 0? 0:-1);
EDIT: fetch for null option
int sign = (String.IsNullOrEmpty(op) ? 0 : (op == "+") ? 0 : -1);
source share