Please tell me hoe we do comment in asp.net MVC with a suitable example.
How we do comments in Asp.Net MVC Razor View?
469
05-Feb-2020
Updated on 05-Feb-2020
Nishi Tiwari
05-Feb-2020To do 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 this ("@* *@").
The syntax for Commenting in Razor View
Syntax of comments in asp.net razor view will be shown like below
These razor view syntax (“ @* *@") tells that which code inside this will be ignored from being executed. The syntax is common for both vb.net and C# language using Razor.
Shortcut to Comment Block
The shortcut for Razor Commenting is similar to C# shortcut which would be shown
The examples will show how to use razor comments in asp.net MVC applications
Example1
The example shows how to use comments in MVC razor view
Example2
This is another example to use comments in MVC razor view
This way we can use comments in razor view applications in asp.net MVC.