36

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?

Daniel T.
  • 37,212
  • 36
  • 139
  • 206

1 Answers1

71

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.

RPM1984
  • 72,246
  • 58
  • 225
  • 350