✅ This label has not been referenced error by "defualt:"
this code sample about switch case
generated these warnings
warning CS0162 and CS0164 on "defualt:" line
warning CS0162: unreachable code detected
warning CS0164: This label has not been referenced
MSDN
no explanation about l1: could be find on google or any documentations. 🙂
Please if someone could explain why defualt: generated those two errors (warnings) I would be grateful.
Thanks in advance XO
3 Replies
It's a typo! It should be
default:
the syntax
Identifier:
is labaled statement, used with goto
because you dont have any goto
to defualt
(which is typo) and the statement placed after break;
so the compiler warn you unused label and unreachable codeThank you. I wanted to know why the compiler recognizes it as a label, and what even is a label in that context
Thanks
Thank you very much.