What is Razor Syntax?


Razor is a markup syntax for embedding .NET-based code into web pages. The Razor syntax consists of Razor markup, C#, and HTML.

What is Razor Syntax?

Written by: Dominic Wegrzynowski Oct 04, 2023

´╗┐Razor is a markup syntax for embedding .NET-based code into web pages. The Razor syntax consists of Razor markup, C#, and HTML. Files containing Razor generally have a .cshtml file extension. The syntax is similar to the templating engines of various JavaScript single-page application(SPA) frameworks such as Angular, React and VueJS, etc.

Razor syntax is used in all Views of each of my MVC applications. Identified by the prefixed "@" symbol, you can see an example of its use in this section of the layout of my blog project. Code commented with Razor syntax is not rendered to the client.


Tags

Login to add a comment
0 COMMENT(S)