How do you declare a comment using the Razor view engine?

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?


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.

链接地址: http://www.djcxy.com/p/85288.html

上一篇: 如何在cshtml模板中创建一个函数?

下一篇: 你如何使用Razor视图引擎声明评论?