Commenting in Razor view is 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 ignore from being executed. This syntax is common for both vb.net and c# language using Razor.
The shortcut for Razor Commenting are similar to C# shortcut that would be like as shown
Comment the block - ( Ctrl E, C)
Uncomment the block - ( Ctrl E, U)
Following examples will show how to use razor comments in asp.net mvc applications
Following example shows how to use comments in 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.