Razor syntax (4)

Source: Internet
Author: User
1.@
Indicates starting a razorCodeBlock, razor will automatically match the curly braces in the Code, such as @ if (P. Active) {<li> @ P. Name </LI>}

2. @ {Code}
Identifies a razor multi-line code block, which is equivalent to <% code %>

3. @ Model
Specify viewmodel, @ model mvcproject. UI. Models. productmodel

4. @ Section sectionname {}
Defines a local layout, similar to the contentplace of the master, which can be presented in the layout Template Using @ rendersection.

5.@:
Specifies that the current processing is based on content, but there can be embedded razor code

6. <Text>... </text>
The function is the same as @:. The difference is that multiple lines of content can be specified.

7.@*....*@
Note

8. @ (Expression)
Used to assist in razor recognition expressions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.