string Test(bool @bool) => $"you're {@bool?"hired":"fired"} Have a nice day!";
The code above results in compilation error.
But why?
Notice that
string test = $"this {"is"} working";
works.
string Test(bool @bool) => $"you're {@bool?"hired":"fired"} Have a nice day!";
The code above results in compilation error.
But why?
Notice that
string test = $"this {"is"} working";
works.
The colon ends the interpolation. Just parenthesize the condition :
string Test(bool @bool) => $"you're {(@bool ? "hired":"fired")} Have a nice day!";
For this issue you you can not use of ?,:
of some thing like these, for using of these you have to set Exactly your condition should put in ()
like:
string Test(bool @bool) => $"you're {(@bool ? "hired":"fired")} Have a nice day!";
You can try to use ()
contain your ?:
Operator
string Test(bool @bool) => $"you're {(@bool ? "hired":"fired")} Have a nice day!";