How do you declare a comment using the Razor view

2019-02-21 06:52发布

This question already has an answer here:

Using ASP.NET MVC's default view engine, you can declare a server-side comment like this:

<%-- This is a comment --%>

This comment will only be visible on the server side and is not sent to the client. How would I do the same with the Razor view engine?

1条回答
贪生不怕死
2楼-- · 2019-02-21 07:41

Start the comment block with @*, end the comment block with *@.

Similar to C# (/* and */)

@* single line comment *@

or

@*
    this is a comment
    this is another
*@

More on Razor comments on the Gu's blog.

查看更多
登录 后发表回答