ASP.NET RazorLesson 20Free preview
Razor Syntax
This lesson is part of ASP · All levels
Summary
The Razor syntax is very concise: the block of code opens with @{and closes with}, whereas the expression is written directly with the sign @. To display the @ sign literally use @@, and the server comment is written with @*... *@. With these rules, HTML is still read even though it contains a lot of logic.
Key points
- The Razor block uses @{} whereas the single expression uses @values.
- The @@ symbol is used to display the @ literal character.
- The server comment is written with @* comment text *@.
- The curve on the @(expression) separates the code from the surrounding text.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.