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