Reputation: 29041
Since it's pretty difficult to search Google for punctuation...
I know in Razor that @
starts a code block, but what does @*
do? As far as I can tell in VS, it starts a comment block. If that's different from /*
, how?
Upvotes: 3
Views: 1839
Reputation: 11637
For ASP.NET Razor comments, you start the comment with @* and end it with *@. The comment can be on one line or multiple lines.
And if I understand you correctly the /*
only applies from within a <% %>
block because /* */
is C# syntax for a comment. You can write @*
from outside a <% %>
block.
So instead of writing comments like
<% /* This is
a multiline comment */ %>
It can be written as:
@* This is
a multiline comment *@
Upvotes: 1
Reputation: 52518
@* is a server side comment:
If you have code like this:
<p>
/* comment 1 */
@* comment 2 *@
<!-- comment 3 -->
@{ /* comment 4 */ }
</p>
comment 1 will not work, because you are not in server mode. That code will be send to the browser, and the browser will show it, because /* is not an html comment.
Also comment 3 will be sent to the client. And I even think, it will be parsed and executed on the server if it contains @ blocks.
Comment 2 and 4 will not be send over the line. but Nr 4 is a bit ugly.
Upvotes: 6