ASP.NET MVC3 Razor - What does @ * do?

Since it’s pretty hard to find Google for punctuation ...

I know in Razor what @launches a block of code, but what does it do @*? As far as I can tell in VS, it runs a block of comments. If it is different from /*how?

+3
source share
2 answers

@ * - server side comment:

If you have a 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. This code will be sent to the browser and the browser will show it because / * is not a html comment.

A comment will also be sent to the client. And I even think that it will be parsed and executed on the server if it contains @ blocks.

2 4 . Nr 4 .

+6

: http://www.asp.net/webmatrix/tutorials/2-introduction-to-asp-net-web-programming-using-the-razor-syntax

ASP.NET Razor @* * @. .

, /* <% %>, /* */ # . @* <% %>.

<% /* This is
a multiline comment */ %>

:

@* This is
a multiline comment *@
+1

Source: https://habr.com/ru/post/1789375/


All Articles