0
没有人有关于为什么使用本地变量很好,但铸造内联不起作用的想法?我显然在这里失去了一些东西,但我看不到它。剃须刀内联铸造工作不正常 - 需要正确的语法
@if (Model is ISectionInformationProvider)
{
ISectionInformationProvider local = (ISectionInformationProvider)Model;
@* The line below just prints as text *@
<h1>@((ISectionInformationProvider)Model).SectionTitle</h1>
@* These work just fine *@
<h1>@local.SectionTitle</h1>
<p>@local.SectionDescription</p>
}
认为这是唯一的排列我没有尝试!这样做似乎不自然。谢谢。我会尽快表示接受 – James