The Razor view engine is the newly expanded content in ASP. NET MVC3, and is also its default view engine. There is another Web Forms view engine. The previous article shows that the view is created in ASP. MVC5, which uses the Razor view engine by default. and the real one. Remember the previous version, you can also let the developer choose whether to use the razor or Webfroms view engine.
razor provides a streamlined syntax for view representations, minimizing syntax and extra characters. This effectively reduces grammatical barriers and does not have new syntax rules in the View markup language. razor supports two file types, the. cshtml and. Vbhtml, where the. cshtml server code uses the C # syntax. Vbhtml's server code uses the vb.net syntax. The core conversion character of the razor syntax razor is the "at" sign (@). The character function used as a token-code conversion character. code-the converted character of the tag. has two basic types of conversions: code expressions and code blocks. The value of the expression is calculated and the value is then written to the response. Code expression Implicit code expression Example: 1 @{string strName = "Wofly";} 2
[ASP. Mvc]asp.net MVC5 series--razor syntax