Razor, View Engine for ASP.Net MVC

Razor is the default, and one worthy to master, view engine for ASP.Net MVC.

The character “@” is important character in Razor, and this indicates the beginning of  code statement.

Razor understand “@” and how it should behave, but sometimes use of “@” is tricky and want to work things around.  If you have view code like below

Razor see the tag <p> and understand that you are trying to express html code.

But if you don’t have html tag and simply want to display text, Razor does not understand you, unless you say

or if you can put tags to tell razor that it is text.

If you want to comment, or comment out some block while you are developing, you can use;



Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.