[Asp.net MVC] Asp.net MVC5 series -- Razor syntax, mvc5razor
The Razor view engine is a new extended content in Asp.net MVC3 and is also its default view engine. There is also a Web Forms view engine. The previous article shows that the Razor view engine is used by default to create a view in Asp.net mvc5. And the real one. In the previous version, developers can choose whether to use the Razor or webfroms view engine.
Razor provides a simplified syntax for view representation, minimizing the syntax and extra characters. This effectively reduces the syntactic barriers and does not have any new syntax rules in the view markup language. Razor supports two file types:. cshtml and. vbhtml. The. cshtml server code uses the c # syntax, And the. vbhtml server code uses the vb.net syntax. The core conversion character of Razor syntax is the "at" symbol (@). This character is used to mark the Conversion characters of the Code. Code-converted characters marked. There are two basic types of conversions: Code expressions and code blocks. Find the value of the expression and write the value to the response. Code expression implicit code expression example: 1 @ {string strName = "wofly";} 2