36

使用 ASP.NET MVC 的默认视图引擎,您可以像这样声明服务器端注释:

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

此评论将仅在服务器端可见,不会发送到客户端。我将如何使用 Razor 视图引擎做同样的事情?

4

1 回答 1

71

注释块以 开始,注释块以@*结束*@

类似于 C# (/**/)

@* single line comment *@

或者

@*
    this is a comment
    this is another
*@

更多关于 Razor 的评论在Gu 的博客上

于 2010-12-17T03:51:37.970 回答