简体   繁体   中英

Why does Visual Studio highlight double curly braces in Razor (.cshtml/.razor)?

Although I have been working with Razor pages( .cshtml ) and Razor components( .razor ) in Blazor for a while in Visual Studio 2019, I did not stumble upon this feature up until now where it highlights anything between two pairs of braces: {{ }} .

It does it for both Razor pages( .cshtml ) and Razor components( .razor ). There is no mention of such syntax in the Razor syntax documentation . What purpose was the {{}} syntax intended to serve? What am I missing?

This is what it looks like. The text is highlighted in hot pink:

双括号之间突出显示的文本。

This is what the same highlight looks like in the light theme:

浅色主题中突出显示的文本

This is mapped by the "HTML Client Template Value" setting in Tools|Options.

It is a piece of HTML syntax used in ao Angular for data-binding,
like <h1> {{user.username}} </h1> . Comparable to Blazor's yellow @

I don't think this has any meaning in a Blazor (razor) file. Safe to ignore.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM