Commenting in Razor view is a little different than c# comments. In C#, we use (“//") for commenting, but in Razor, we will define comments like ("@* *@").
The syntax of comments in asp.net razor view will be like as shown below.
@* This is a Razor multiline comment *@
This razor view syntax (“ @* *@") tell that code inside this should be ignored from being executed. This syntax is common for both vb.net and c# language using Razor.
The shortcut for Razor Commenting is similar to the C# shortcut that would be as shown.
Comment the block - ( Ctrl E, C)
Uncomment the block - ( Ctrl E, U)
The following examples will show how to use razor comments in asp.net MVC applications.
The following example shows how to use comments in the mvc razor view.
Following is another example to use comments in mvc razor view
This way, we can use comments in razor view applications in asp.net mvc.