这段代码在构建我的项目时失败。如果声明必须检查ParkingLot是否为真。我认为这样做是下面的代码的方式:if语句失败时为true
<th class="small-12 large-6 columns last">
<table>
<tr>
<th width="300">
<p class="text-left small-text-left">
@if(Model.Point.Store.JsonDynamic.En.Motel.ParkingLot == True)
{
<span>Possibility for parking</span><br>
}
</p>
</th>
<th class="expander"></th>
</tr>
</table>
</th>
但我得到这个错误:
Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: Cannot implicitly convert type ''Newtonsoft.Json.Linq.JValue'' to ''bool''. An explicit conversion exists (are you missing a cast?)
任何人都可以看到我在做什么错在这里?
尝试铸造为布尔。 @if((bool)Model.Point.Store.JsonDynamic.En.Motel.ParkingLot == True){...} – Aaron