为什么Razor不能像其他语言那样逃避引号?

时间:2017-09-27 09:17:52

标签: asp.net-mvc razor

我试图用剃刀编写一些代码,但这种语言的工作方式与其他语言不同,我不知道问题出在哪里。

我写了这样的代码:

<div class="header"@(ViewBag.template_conditional_preprints.Count == 0 ? " style=\"display: none\"" : "")>

应呈现:

<div class="header" style="display: none">

但它呈现(不知道会发生什么):

<div class="header" style="&quot;display:" none&quot;="">

为什么会发生这种奇怪的转换以及如何避免这种魔术转换并渲染除外的字符串?

0 个答案:

没有答案