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>
*@

No comments:

Post a Comment

How to register multiple implementations of the same interface in Asp.Net Core?

 Problem: I have services that are derived from the same interface. public interface IService { } public class ServiceA : IService { ...