asp.net mvc 3

What is the syntax for server side comment in razor view?

I want to comment this code:

/*
@helper NavItem() {

}
*/

@* here is the code to comment *@

Both of the following work

@{
/*
    This is a comment
*/}


@//This is another comment

Update

With the new Beta of MVC 3 out the old methods of highlighting won't work.

@{
    //This is a comment
}

@{/*
      This is a multi
      line comment
*/}

@*
      This is a comment, as well
*@

Is the updated method @//This is a comment and @/* */ will no longer work.


在.cshtml文件中,只需按下Ctrl + K和Ctrl + C,你会看到评论是由Visual Studio自动添加的(或者,cntrl_k和cntrl + u取消注释)。否则,如果你想手动编写它, ,只是随便吧

@* Your Code *@
链接地址: http://www.djcxy.com/p/85286.html

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

下一篇: asp.net mvc 3