ASP.NET MVC > Views - Razor Engine

Comment in Razor view in ASP.NET MVC

How to comment in razor view?


To comment in the code block of Razor view, we use the same syntax as we use in C#. Like for single line // and for multiline /* and */.

// Single line comment
/* * multi * line * comment */

To comment, HTML along with other code, we need to use razor comment block that starts with @* and ends with *@.

@*
<h3>Inline expression</h3>
This is @fileName logo.
<h3>Code Expression</h3>
<p>Sum is @(a + b)</p>
*@

 Views: 69914 | Post Order: 11



Write for us






Hosting Recommendations