我使用 Razor 非常遵循这种模式:
@if (Model.IsAlreadyConfirmed)
{
This account has already been confirmed.
}
但这不起作用,因为它需要代码。我被迫做这样的事情:
@if (Model.IsAlreadyConfirmed)
{
@Html.Raw("This account has already been confirmed.")
}
或这个:
@if (Model.IsAlreadyConfirmed)
{
<span>This account has already been confirmed.</span>
}
另外,请随时纠正我对行话的不当使用。