I have below switch:
int op = step.BasicOP;
string myOp = "someOperation";
OperationType x;
switch(myOp)
{
case "test":
x = OperationType.OP1;
//some code
break;
case = "someOperation";
x = OperationType.OP2;
//some code
case "other example":
//some code
break;
default:
throw new ArgumentException("not covered");
}
addRound.addProps("Operation", x);
but for case "other example" I did not set x. Instead I need to pass there op. So I'm doing like:
//if x is not set, pass/take op
addRound.addProps("Operation", x : op);
But this is wrong. How to correct write?
Aucun commentaire:
Enregistrer un commentaire