You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm curious why the @{} syntax is only allowed inside html and not inside c# portions of a razor file, generating error RZ1010.
In comparison the comment syntax @**@ is valid throughout the razor file.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm curious why the
@{}
syntax is only allowed inside html and not inside c# portions of a razor file, generating error RZ1010.In comparison the comment syntax
@**@
is valid throughout the razor file.Let's start with some code
Now if we wrap it in an if statement, the code
@{...}
is no longer valid, generating error RZ1010We can fix it by falling back to classical C# syntax
However here is my concern, let's say we later want to either:
<div>
In both scenarios the code is now being rendered.
Is there a reason why
@{}
not valid everywhere in the razor file whereas for example@**@
is valid?Beta Was this translation helpful? Give feedback.
All reactions