The Razor syntax refers to how you write code mixed inside your view markup. Remember that this code is meant to run on the server. The Razor syntax strives to make it easy to embed code throughout your page. If you have done this in earlier versions of ASP, you will recall things like brackets and percent signs (
<% ... %>) to indicate code start and end blocks. These statements were painful to write and hard to read. Razor makes it much easier.
Razor uses the at sign,
@, to indicate an inline expression of code. Typically, this is all you need to tell the engine that you intend it to process some code on your page. If you have just a single line of code, you can embed it right within your HTML. The following markup with Razor ...