公告
财富商城
积分规则
提问
发文
2019-01-16 09:51发布
成全新的幸福
What is the syntax for server side comment in razor view?
I want to comment this code:
/* @helper NavItem() { } */
Both of the following work
@{ /* This is a comment */} @//This is another comment
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.
@//This is a comment
@/* */
@* here is the code to comment *@
Inside the .cshtml file, just press cntrl+k and cntrl+c, You will see the comment is automatically added by visual studio.(alternatively, cntrl_k and cntrl+u for uncommenting.) Or else if you want to write it manually then, just gohead with
@* Your Code *@
If its in your view, couldn't you use the standard HTML <!-- ... //--> or the .NET style <%-- .. --%>?
<!-- ... //-->
<%-- .. --%>
最多设置5个标签!
Both of the following work
Update
With the new Beta of MVC 3 out the old methods of highlighting won't work.
Is the updated method
@//This is a comment
and@/* */
will no longer work.Inside the .cshtml file, just press cntrl+k and cntrl+c, You will see the comment is automatically added by visual studio.(alternatively, cntrl_k and cntrl+u for uncommenting.) Or else if you want to write it manually then, just gohead with
If its in your view, couldn't you use the standard HTML
<!-- ... //-->
or the .NET style<%-- .. --%>
?