When I want to use the colon ":" in my case statement of a string operator, I get the error message "unterminited string literal", how can I fix it and why does it give an error?
code:
@switch (stringText) { case "aaaa:ggg": Do something... break; case "bbbb:ggg": Do something else... break; }
If fixed, by doing this, but not finding it a good solution:
const string extra = ":ggg"; @switch (stringText) { case "aaaa" + extra: Do something... break; case "bbbb" + extra: Do something else... break; }
EDIT: uses MVC Razor syntax
Kevin source share