编程语言
首页 > 编程语言> > Razor syntax reference for ASP.NET Core

Razor syntax reference for ASP.NET Core

作者:互联网

Razor syntax reference for ASP.NET Core

 

Razor is a markup syntax for embedding server-based code into webpages.

The Razor syntax consists of Razor markup, C#, and HTML.

Files containing Razor generally have a .cshtml file extension.

Razor is also found in Razor components files (.razor).

Rendering HTML

The default Razor language is HTML.

Rendering HTML from Razor markup is no different than rendering HTML from an HTML file.

HTML markup in .cshtml Razor files is rendered by the server unchanged.

Razor syntax

Razor supports C# and uses the @ symbol to transition from HTML to C#. Razor evaluates C# expressions and renders them in the HTML output.

When an @ symbol is followed by a Razor reserved keyword, it transitions into Razor-specific markup. Otherwise, it transitions into plain C#.

 

标签:Razor,ASP,reference,C#,markup,syntax,HTML,into
来源: https://www.cnblogs.com/chucklu/p/11510747.html